Question about Patterns

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
phpCCore Brad
Forum Commoner
Posts: 47
Joined: Sun Dec 04, 2005 5:46 pm
Location: Michigan, USA
Contact:

Question about Patterns

Post by phpCCore Brad »

Hi, I have been working more and more with patterns and I have came across a problem I can't figure out. I need to find what is between a string and a space.

Example of the string which is code:

Code: Select all

query("INSERT INTO " . db_extension() . "keywordPrim (keyword,count) VALUES ('" . $word . "','" . $endCounts[$key] . "')");
I need to find what is between db_extension() . " and the blanks space after keywordPrim.

I have the following search:

Code: Select all

eregi('\db_extension\(\) \. \"([^[]*)\s', $file, $matches);
This returns the following array:

Array ( [0] => db_extension() . "keywordPrim (keyword,count) VALUES ('" . $word . "','" . $endCounts [1] )

I have tried using the hex versions of the blanks space and the ( and either get nothing or the same results. Any help would be greatly appreciated.

Thanks
Post Reply