RE: [PHP-DB] Searching a file for text surrounded by brackets

2003-07-16 Thread Ford, Mike [LSS]
> -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:
> 
> {L_LOGIN}
> {L_LOGOUT}
> 
> 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



[PHP-DB] Searching a file for text surrounded by brackets

2003-07-16 Thread Jamie Saunders
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:

{L_LOGIN}
{L_LOGOUT}

So I'll need to search the above for text between the '{' and '}' brackets
and read each into an array.

-- 
Jamie Saunders
Media Architect
[EMAIL PROTECTED]



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