hey guys i got the following preg_match
which checks if there's space / a-z / 0-9 in the string...Code:preg_match('/[^a-z0-9 ]/i', $title)
Now i want to add another character '|', where in the code above do i need to add it so it'll work properly?
| SitePoint Sponsor |



hey guys i got the following preg_match
which checks if there's space / a-z / 0-9 in the string...Code:preg_match('/[^a-z0-9 ]/i', $title)
Now i want to add another character '|', where in the code above do i need to add it so it'll work properly?
Have you actually tried just sticking it in there next to the other characters you're checking for?
PS: This function as written will check if there's anything EXCEPT a-zA-Z0-9 and space in the string.
Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.



Yeah thats what i meant, my bad :PPS: This function as written will check if there's anything EXCEPT a-zA-Z0-9 and space in the string.
Yes i tried it like this:Have you actually tried just sticking it in there next to the other characters you're checking for?
didnt seemed to work thoughtCode:preg_match('/[^a-z0-9| ]/i', $title)
So you put in "This is a | test" and it comes out with a number?
Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.



hmm u right with ur example it does work, i tried with an example in hebrew which didnt, probably encoding issue, ill have to take a deeper look
nother question regarding this, if i want to adda also '-' character, ill have to do it like that? '\-'
Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.
Just because I learned so much there, some related links..
Wonderfull tool to learn and test regex
http://gskinner.com/RegExr/
give it a try and put it in bookmarks - I use it reguarly..
also usefull
http://txt2re.com/
regards
Hensel
Bookmarks