regex - PHP preg_match full string -
i'm trying verify string matches pattern. is, full string can written pattern. preg_match
returns true
, if substring matches pattern. (e.g. preg_match("#[a-z]*#, "333k")
returns 1
, don't want to. in example i'd rather verify, whole string contains small latin letters.)
you use start , end markers, ^
, $
respectively, indicate beginning , end of string in regular expression pattern. way can make expression match whole string, not kind of substring. in case this:
preg_match("#^[a-z]*$#", "333k");
you can also, 1 these markers, specify pattern must match beginning or end of string.
Comments
Post a Comment