Posted By: Anonymous
My regex pattern looks something like
<✘✘✘x location="file path/level1/level2" ✘✘✘x some="✘✘✘">
I am only interested in the part in quotes assigned to location. Shouldn’t it be as easy as below without the greedy switch?
Does not seem to work.
You need to make your regular expression non-greedy, because by default,
"(.*)" will match all of
"file path/level1/level2" ✘✘✘ some="✘✘✘".
Instead you can make your dot-star non-greedy, which will make it match as few characters as possible:
? on a quantifier (
+) makes it non-greedy.