Further Regex

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Further Regex

Post by mjseaden »

Dear All

I have a string (actually a MySQL query) of the form

Code: Select all

SELECT * FROM Properties WHERE RegionID=X ORDER BY Price
Is there a simple RegEx I could use to extract 'X' from the query?

Many thanks

Mark
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Maybe:

Code: Select all

preg_match('#RegionID=(.[^ ]*)#', $string, $matches);
echo $matches[1];
Post Reply