Multi-line, Non-Greedy GREP Find

569 views
Skip to first unread message

Warren Michelsen

unread,
Aug 19, 2009, 1:24:29 PM8/19/09
to bbe...@googlegroups.com
How do I get this pattern to stop after finding the first "</td>" tag? I want to replace <td> tags that span multiple lines.

<td class="redline">([\s\S]*)</td>

Ronald J Kimball

unread,
Aug 19, 2009, 1:36:45 PM8/19/09
to bbe...@googlegroups.com

The simplest way is by using a non-greedy quantifier:

<td class="redline">([\s\S]*?)</td>

Ronald

Warren Michelsen

unread,
Aug 19, 2009, 1:43:24 PM8/19/09
to bbe...@googlegroups.com
At 1:36 PM -0400 8/19/09, Ronald J Kimball sent email regarding Re:
Multi-line, Non-Greedy GREP Find:

I thought the non-greedy qualifier had to be associated with the
close tag and therefore after the closing parentheses. I tried
putting it all kinds of places, except inside the parentheses.

Reply all
Reply to author
Forward
0 new messages