You are here: RegEx - Chk for special chars « PHP Programming Language « IT news, forums, messages
RegEx - Chk for special chars

Posted by M Kinnear on 04/29/07 23:37

I want to check a string only contains a-z 0-9 ( ) . and #

I've used

ereg("^[a-zA-z0-9().#]*)$"),$instr)

which parses a string correctly until I try and parse a !,",�,$ ... or any
of the other special/reserved characters.

First q: what am I doing wrong
Second q: is there clarification on whether characters need to be escaped
when part of a regex statement? i.e., should it be [$] or [\$] - some
websites/posts state they should be escaped, others say they shouldn't


Thanks

Matt

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация