in reply to Regular expression problem
Another potential bug is the fact that you're relying on $1 without first checking to see if a match succeeded. Bad dog.
Regarding your question, you might successfully get your regexp to match less by using the non-greedy modifier on the quantifier.
$var =~ /onChange\=\"\[(.*?)\]\"/;
The '.*?' construct says to match as little as possible of any number of characters until the first ]" is reached.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Regular expression problem
by jockel (Beadle) on Jun 09, 2004 at 08:26 UTC |