Carlos
2/13/2007 2:53:00 PM
Robert Dober wrote:
[...]
> Well it might be necessary to use a non greedy match
>
> /<param.*value="(.*?)"/
>
> in order not to consume a potentially following key="..." pair.
>
> A more explicit and thus more readable way might be to write it like this -
> avoiding any potential backtracking issues if the regexp evolves later too.
>
> /<param.*value="([^"]*)"/
Your advice of using a non greedy match is good, but the example using a
greedy match is not ;)
your_re =~ '<parameter value="1"/> ... bla bla bla ... value="ha!"'
puts $1
Greetings.
--