Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP and MYsql regular expression 2

Status
Not open for further replies.

ksoong

Programmer
Oct 3, 2000
57
CA
Hi everyone,

I need help on how I can create a search engine that allows you to input regular expressions. (ie re*g*r would return "regular" from the Mysql database).

I'm trying to figure out the Mysql select statement that would includ the regular expression that I could use in a PHP query statement.

I've searched all over the net and can't find anything. can anybody help me?
 
Code:
$q = "re*g*r";

$q = ereg_replace("*", "%", $q);

mysql_query("SELECT * FROM ... WHERE ... LIKE '%$q%'");

Does that help? Girish Gupta
girish@musicgoeson.com
 
Yes very!

that is probably one of the most useful, to the point, responses i've received yet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top