Forum Moderators: coopster
--------------
I'm still having trouble, I think this has been greatly confusing me.
if $s = 2342342; that echos OK
if $s = $; that echos NOT OK
but if I add in accepted characters with non accepted characters it always returns ok.
if $s = $23232; that echos OK
any ideas?
that seems to echo OK for whatever $s is.
-------------------------------
Maybe, I'am trying to use the wrong function. I only want to allow those characters, but it seems like, that function is just determining if those characters appear in the preg_match. So it will always give me a green light if they appear, I guess.
Is there a function, that will return, IF AND ONLY IF those characters appear. And if another one appears don't accept it.
The only other way I've made it work, is making a preg_match for all the characters to disallow.
But I want it to only allow certain characters, not just tell me whether or not the characters show up. So maybe preg_match, now that I really understand it isn't what I need am I correct here?
preg_match('/^[a-z0-9]+$/iD', $text).
-------------
I assume the difference here is the inclusion of the /iD.
What does that do? I know the i does the in-case sensitve. but the D?
I assume that is different that what we were doing, can someone explain. Thanks! for all the help!
D (PCRE_DOLLAR_ENDONLY)If this modifier is set, a dollar metacharacter in the pattern matches only at the end of the subject string. Without this modifier, a dollar also matches immediately before the final character if it is a newline (but not before any other newlines). This modifier is ignored if m modifier is set. There is no equivalent to this modifier in Perl.