Re: regex help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jason Morehouse wrote:
> Simple enough, in theory... I need to match (count) all of the bold tags
> in a string, including ones with embedded styles (or whatever else can
> go in there).  <b> and <b style="color:red">.  My attempts keep matching
> <br> as well.

I think something not unlike:

'/<b( .*>|>)/'

The point being that you either have JUST '>'  OR you have a SPACE and
whatever and '>'

I leave the capitalization and 'greedy' settings up to you.

The previous solution using '<b[^r]' will work only until the goofball
browser wars give us some other <bX> tag where X is a single character in
the alphabet.

There's a pretty cool Windows/Linux product a colleague swears by that's
called RegexCoach (?) which will not only let you try out
expressions/values and tell you which ones pass/fail, but you can
highlight sub-sections of the expression/values and see what it matches
piece by piece.

It's donationware -- try it out and donate the $20 (oooh, hurt me) if you
like it.

http://www.weitz.de/regex-coach/

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux