The following works fine for me:
$currentword = ereg_replace("\*","%",$currentword);
Chris
}:)
> -----Original Message-----
> From: matt stewart [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, January 15, 2002 9:57 AM
> To: [EMAIL PROTECTED]
> Subject: RE: [PHP-DB] Replacing * with %
>
> 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:[EMAIL PROTECTED]]
> Sent: 15 January 2002 09:54
> To: [EMAIL PROTECTED]
> 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:[EMAIL PROTECTED]]
> Sent: 15 January 2002 09:40
> To: [EMAIL PROTECTED]
> 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
> [EMAIL PROTECTED]
> +358-6-325 3589 / +358-40-832 6709
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> ---
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> ---
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]