You are here: regex help « PHP Programming Language « IT news, forums, messages
regex help

Posted by Sugapablo on 10/22/56 11:20

Could someone help me out with a regular expression?

I need to be able to search a text field and grab every instance of a
string that falls between <tag class="name"> and </tag>.

We can assume that the tags will always be written properly.


So if the following is my text field: "They streamed across the Clemente
Bridge, docked along the <tag class="name">Allegheny River</tag>, strolled
from the North Side and biked down the trail to watch their Pirates. <br/>
They filled <tag class="name">PNC Park</tag> to the last sliver of
standing-room space on the rotunda, <tag class="name">37,259</a> strong.
<br/> And they came in full throat, chanting and cheering from the outset."

....I'd need the code to return, probably an array, like this:
$array[0] = Allegheny River
$array[1] = PNC Park
$array[2] = 37,259


I just can't get it. Any suggestions?

--
[ Sugapablo ]
[ http://www.sugapablo.net <--personal | http://www.sugapablo.com <--music ]
[ http://www.2ra.org <--political | http://www.subuse.net <--discuss ]

 

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

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