in reply to Non-greedy regex behaves greedily
I would like to reopen this with a similar question.
Target string:Back to STATES Menu</font></a></h3> <p align="center"><a href="index.htm"><img src="home2.gif" alt="Home" border="0" width="106" height="30"></a></p> </body> </html>
regex:</a>.*?$
or</a>.*?\$
matches:</a></h3> <p align="center"><a href="index.htm"><img src="home2.gif" alt="Home" border="0" width="106" height="30"></a></p> </body> </html>
I expect it to match:</a></p> </body> </html>
Both PERL and Regex Coach seem to concur, so I must be missing something.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Non-greedy regex behaves greedily (leftmost)
by tye (Sage) on Jul 28, 2008 at 06:09 UTC | |
|
Re^2: Non-greedy regex behaves greedily
by linuxer (Curate) on Jul 27, 2008 at 17:43 UTC | |
by kovacsbv (Novice) on Jul 27, 2008 at 23:36 UTC | |
by ysth (Canon) on Jul 28, 2008 at 10:03 UTC |