By non-greedy, Luc means:
text=\"(.+?)\"
The problem that you're having is that quantifiers like + and * try to match
as long a string as possible by default, so it's matching the " near the end
of the string. This is called "greedy matching". The two ways around it are
either to use a negated character class (as Luc suggests) that prevents
skipping any ", or by adding the non-greedy "?" modifier to the quantifier.
--
Eric Gunnerson
Visit the C# product team at
http://www.csharp.net
Eric's blog is at
http://blogs.gotdotnet.com/ericgu/
This posting is provided "AS IS" with no warranties, and confers no rights.
"Luc E. Mistiaen" <lu**********@advalvas.be> wrote in message
news:u$**************@TK2MSFTNGP12.phx.gbl...
non greedy search or "text=\"([^"]+)\""
"reiks" <an*******@discussions.microsoft.com> wrote in message
news:08****************************@phx.gbl... My requirement is to match the word-'text="Description"'
in the below line
text(band=header alignment="0" text="Description"
border="0" color="8388608" x="206" y="0" height="64"
width="338" font.face="Arial" font.height="-10"
font.weight="700" font.family="2" font.pitch="2"
font.charset="0" background.mode="1"
background.color="536870912" )
I've used the following expression
"text=\"(.+)\"" . But it's not giving me the correct match
Could anyone help em out?
thanks in advance,
reiks