ereg_replace and " ' [ ] \ characters

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
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

ereg_replace and " ' [ ] \ characters

Post by Sindarin »

I have read about ereg_replace. I managed to make it work, but how do I replace " ' \ [ ] characters? They seem to conflict with the script.
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: ereg_replace and " ' [ ] \ characters

Post by ghurtado »

You have to escape them with a backslash
User avatar
JAB Creations
DevNet Resident
Posts: 2341
Joined: Thu Jan 13, 2005 6:44 pm
Location: Sarasota Florida
Contact:

Re: ereg_replace and " ' [ ] \ characters

Post by JAB Creations »

For future references you'll want to use the Regex forums for regex posts. :P
User avatar
Sindarin
Forum Regular
Posts: 521
Joined: Tue Sep 25, 2007 8:36 am
Location: Greece

Re: ereg_replace and " ' [ ] \ characters

Post by Sindarin »

For future references you'll want to use the Regex forums for regex posts. :P
Is there a whole forum for that? 8O
You have to escape them with a backslash
Like if I want to escape [ then I will have to do \[ ?
User avatar
ghurtado
Forum Contributor
Posts: 334
Joined: Wed Jul 23, 2008 12:19 pm

Re: ereg_replace and " ' [ ] \ characters

Post by ghurtado »

Yeah, exactly: \[
Post Reply