String management. Special chars!
|
Light Poster
|
|
| 30Oct2006,04:46 | #1 |
|
I was wondering how to make sure that there are no special chars included in a string like " ^ $ # " which i dont want people to use in their nicknames. In other words, how can i make sure that they only use english characters and numbers. I have tried to figure it out on PHP documentation but appears to be too complex for a beginner.
|
|
Team Leader
|
![]() |
| 30Oct2006,11:23 | #2 |
|
You have to use Regular Expressions (regex) to filter out bad characters.Checkout the exmaple below.
Code: PHP
|
|
Light Poster
|
|
| 30Oct2006,14:58 | #3 |
|
Thanks alot! That "regex" syntax is really lookin hard. Hope i can figure it out. There are so many characters to be omitted, so working out the pattern will be something messy i guess.
|
|
Team Leader
|
![]() |
| 30Oct2006,15:09 | #4 |
|
That regex only allows alphabets and numbers, do you want to remove the bad characters or just inform the user that he has enter some bad characters in his/her nickname?
|
|
Light Poster
|
|
| 30Oct2006,15:09 | #5 |
|
I just noticed that the example pattern you've given filters out the entire charz except letters and numbers. Now the question is how to ommit numbers and allow some spesific charz.
|
|
Light Poster
|
|
| 30Oct2006,15:11 | #6 |
|
What i exactly want is to make users chose their nicknames whic will only match the pattern i set.
|
|
Team Leader
|
![]() |
| 30Oct2006,15:11 | #7 |
|
Code: PHP
|
|
Light Poster
|
|
| 30Oct2006,15:16 | #8 |
|
Wow, i guess i now got it. Thank you very much pradeep. I love php =).
|
|
Team Leader
|
![]() |
| 30Oct2006,15:24 | #9 |
|
Me too! Keep posting, about your problems discoveries and inventions.
|

