> -----Original Message-----
> From: Jamie Saunders [mailto:[EMAIL PROTECTED]
> Sent: 16 July 2003 11:20
> 
> Hi, I need a way of searching a file for text between two 
> brackets, below
> is an example of a couple of lines from the file I'm searching:
> 
> <tr><td><font size="2">{L_LOGIN}</font></td></tr>
> <tr><td><font size="2">{L_LOGOUT}</font></td></tr>
> 
> So I'll need to search the above for text between the '{' and 
> '}' brackets
> and read each into an array.

preg_match_all() (see http://www.php.net/preg_match_all) should do what you
want -- something like:

     preg_match_all('/{([^}])+}/', $file_contents, $matches);

should give you an array of matched tags (excluding the braces) in
$matches[1].

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211

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

Reply via email to