views:

125

answers:

2

I have been programming a word-unscrambler. I need to parse the information between a group of tags and another, and put all matches into an array. The beginning tag is:

<tr> <td></td><td><li>

and the ending tag is:

</li></td> </tr>

I know some regular expressions, but I am unfamiliar with PHP.

+2  A: 
<tr> <td><\/td><td><li>(.*)<\/li><\/td> <\/tr>

Test is here: http://rubular.com/regexes/13241

Gazler
A: 

PHP can cope with both PERL and POSIX regexes, so you'll need to use the function for the flavour that you know. I believe that the code posted by @Gazler should work in either case, though it will need to be surrounded by /s, and quoted:

$reg = '/<tr> <td><\/td><td><li>(.*)<\/li><\/td> <\/tr>/';

There's a PHP PERL regex based test site here: http://j-r.camenisch.net/regex/

PeterJCLaw