RegEx - Chk for special chars
- From: "M Kinnear" <newsgroups@xxxxxxxxx>
- Date: Sun, 29 Apr 2007 23:37:28 GMT
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
.
- Follow-Ups:
- Re: RegEx - Chk for special chars
- From: Toby A Inkster
- Re: RegEx - Chk for special chars
- From: gosha bine
- Re: RegEx - Chk for special chars
- From: Benjamin
- Re: RegEx - Chk for special chars
- Prev by Date: Re: using echo but need something to execute php code
- Next by Date: Re: using echo but need something to execute php code
- Previous by thread: Problem When Serializing Array With Multiline Text
- Next by thread: Re: RegEx - Chk for special chars
- Index(es):