How to match “anything up until this sequence of characters” in a regular expression?

后端 未结 12 2410
旧时难觅i
旧时难觅i 2020-11-22 11:51

Take this regular expression: /^[^abc]/. This will match any single character at the beginning of a string, except a, b, or c.

If you add a *

12条回答
  •  被撕碎了的回忆
    2020-11-22 12:23

    I ended in this stackoverflow question after looking for help to solve my problem but found no solution to it :(

    So I had to improvise... after some time I managed to reach the regex I needed:

    As you can see, I needed up to one folder ahead of "grp-bps" folder, without including last dash. And it was required to have at least one folder after "grp-bps" folder.

    Edit

    Text version for copy-paste (change 'grp-bps' for your text):

    .*\/grp-bps\/[^\/]+
    

提交回复
热议问题