Beginner with ereg_replace
Posted: Mon Jul 17, 2006 4:07 am
Hello all
I have a problem with ereg_replace. Well, more like with regular expressions. I'm new to the syntax of regular expressions in php, so I'm having a few problems with them.
I want to replace all text inside # symbols to surround it with the access to an array, like this:
#hello# would be replaced with $array["hello"]
#hello
all# would not be replaced because it contains a \n
the command I created is ereg_replace("\#([^\n])\#", '$array["\\1"]', $stringToReplace)
am I very far away from the solution?
Thank you all, and sorry if my english is not very good, but I'm from spain
I have a problem with ereg_replace. Well, more like with regular expressions. I'm new to the syntax of regular expressions in php, so I'm having a few problems with them.
I want to replace all text inside # symbols to surround it with the access to an array, like this:
#hello# would be replaced with $array["hello"]
#hello
all# would not be replaced because it contains a \n
the command I created is ereg_replace("\#([^\n])\#", '$array["\\1"]', $stringToReplace)
am I very far away from the solution?
Thank you all, and sorry if my english is not very good, but I'm from spain