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

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -