From: Robert Dober Date: 2006-05-24T04:52:20+09:00 Subject: Re: Regexp help: Matching HTML having trouble w/greediness ------=_Part_163297_10074959.1148413929039 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 5/23/06, Wes Gamble wrote: > > All, > > I am attempting to do some matching on some HTML. > > Here's what I want: > > I want to be able to match any tag which is of the form ...> that does NOT contain a "mailto:" href. The grouping is for some > substitution that I'm doing. > > Here's my pattern: > > /()/mi Let's try ]*?etc. You will find out that this will solve this particular problem but creates other ones like e.g. with this HTML " href=3D"mine:home"> unless, and you tell me, that is not legal HTML anyway I feel that maybe Regexen are not the right tool for your task anymore, dunno. But maybe you can work with the above regex anyway. Cheers Robert What I find is that this pattern will successfully handle most area > tags, however, when an area tag is followed by a tag (which also has > a href attribute, it will match everything between the tag). So, for example, > > other stuff, including tags href=3D"blah"> > > this pattern matches all the way through the end of the tag. > > I tried to stick a negative lookahead (?!<) at the end of the pattern > but that doesn't seem to help. > > How do I get this pattern to STOP matching? > > Thanks for any help, > Wes > > -- > Posted via http://www.ruby-forum.com/. > > --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_163297_10074959.1148413929039--