Reputation: 347
I can't capture what i want with capturing parantheses... I'm searching in /hodsakers/marsh-zwartArray/d and i want to capture marsh-zwartArray but sometimes the last / is not present in what i'm searching. I search and try many things =/ like :
(marshall[\s\S]*)\/
it work but if the last backslash is not present it doesn't. I also try
(marsh[\s\S]*)(\/)?
in this case that's the opposite, it work without the last backslash but not anymore if there is one, it will get all the string and capture nothing =/ So i don't know how i can capture in both cases =/ Thanks for your help
Upvotes: 1
Views: 57
Reputation: 627600
You may use a [^\/]*
negated character class to match 0+ chars other than /
:
/marsh[^\/]*/
See the regex demo
Upvotes: 2