in reply to Re: pattern matching
in thread pattern matching
Be careful using .* as it is one greedy mother. The first .* will swallow everything up to the second last // in your regex.
So if your source text ever happens to have three or more sets of // on a line you regex will fail. Better to use nongreedy, minimal matching using .*?
This is probably so obvious to an expert like Corion, he didn't bother mentioning it. I mention it 'cos the OP states that the regex seems to work.
So if your source text ever happens to have three or more sets of // on a line you regex will fail. Better to use nongreedy, minimal matching using .*?
This is probably so obvious to an expert like Corion, he didn't bother mentioning it. I mention it 'cos the OP states that the regex seems to work.
|
---|
In Section
Seekers of Perl Wisdom