You are here: Re: [PHP] regex help « PHP « IT news, forums, messages
Re: [PHP] regex help

Posted by Richard Lynch on 01/14/05 19:21

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация