Reputation: 85
I am trying to create a regex expression to parse till \
. Can you tell me how to create a regex expression.
The code i had created was
/[^\]*/
Upvotes: 0
Views: 48
Reputation: 40404
If you want to get everything until a slash, just use:
/(.*?)\\/
(.*?)
Capture group, containing the text until slash (not included).*
Match everything 0 or more times.?
make the quantifier (*
) lazy, so it matches only until the first slash if there are more than one.Check this: http://regexr.com/3cnld
Upvotes: 1
Reputation: 84
I find regex101.com really useful for testing regex.
I think you just need an extra backslash...
/[^\\]*/
Upvotes: 1