RE: [PHP-DB] Replacing * with %

From: Date: Tue, 15 Jan 2002 09:57:10 +0000
Subject: RE: [PHP-DB] Replacing * with %
Groups: php.db 
Request: Send a blank email to php-db+get-15813@lists.php.net to get a copy of this message
just checked it out, and * is a special character unless enclosed in class brackets. so using "[*]" should hopefully work! give it a go and see. cheers, Matt -----Original Message----- From: matt stewart [mailto:matt@netvirtua.com] Sent: 15 January 2002 09:54 To: php-db@lists.php.net Subject: RE: [PHP-DB] Replacing * with % /* sorry markus, forgot to post this to the list, so here it is again! */ don't know if this is the solution without doing some reading, so i'll tell you what i think it might be and you can read up on it! is either (or both?) * and % special characters in regular expressions? if so, it may be possible to delimit them with slashes, that would be my thinking anyway. Let me know if i'm right or (more likely) wrong! cheers, Matt -----Original Message----- From: Markus Lervik [mailto:markus.lervik@vaasa.fi] Sent: 15 January 2002 09:40 To: php-db@lists.php.net Subject: [PHP-DB] Replacing * with % Hello all! I can't for the love of god get neither ereg_replace nor str_replace to work. I wan't to replace * with % so I can use SELECT ... WHERE whatever LIKE "string%" in MySQL. I've tried ereg_replace("*","%",$search_name). Didn't work. I tried escaping the asterisk. I tried double-escaping the asterisk. I tried str_replace("*","%",$search_name), and that didn't work either. I tried just about everything I could think of, escaping, double- escaping and triple-escaping ad nauseum, but it just wont work. Oh, yes, I also tried $search_name=ereg_replace(blablabla); What a surprise. It didn't work. Yes, I've RTFM, RTMFM, read from my PHP Blackbook to phpbuilder.net and just about everything in between. Pretty soon I'll start bashing away on that Solaris 8 box over there. Markus - frustrated -- Markus Lervik Linux-administrator with a kungfoo grip Vaasa City Library - Regional Library markus.lervik@vaasa.fi +358-6-325 3589 / +358-40-832 6709 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.313 / Virus Database: 174 - Release Date: 02/01/02

« previous php.db (#15813) next »