reluctant-quantifiers

Regex: Is Lazy Worse?

I have always written regexes like this <A HREF="([^"]*)" TARGET="_blank">([^<]*)</A> but I just learned about this lazy thing and that I can write it like this <A HREF="(.*?)" TARGET="_blank">(.*?)</A> is there any disadvantage to using this second approach? The regex is definitely more compact (even SO parses it better). Edit: T...

Confused about a regex.

I want to match expressions that begin with "${" and end with "}" in the expression ${foo} and ${bar}. The regex .*\$\{.+\}.* matches the entire expression, of course. My understanding was that changing to the reluctant quantifier would solve the problem, but I find that .*\$\{.+?\}.* also matches the entire expression. What am I miss...

Java Regexp: UNGREEDY flag

Hi, I'd like to port a generic text processing tool, Texy!, from PHP to Java. This tool does ungreedy matching everywhere, using preg_match_all("/.../U"). So I am looking for a library, which has some UNGREEDY flag. I know I could use the .*? syntax, but there are really many regular expressions I would have to overwrite, and check th...