regex - PHP preg_match - regular expression -
i have text:
su4r c45g g3hd 61u14xe7ar23 914k16w471lv v6sq5v16lg91 24yl4hw956c3 uz26j12k615v t741mh4n739w 31st445g726h 621eh6vw7q6m 55n629wj945p 56tx2w6lc949 44ds765cf739 xc262hv1jz6v 26yd4n1y71f7 s4m3f1xedc0d
i want use preg_match
find specific type of code in text, should contains:
- 4 or 12 characters
- it should returs elements
- non case sensitive
- letters , numbers
i've ended this:
preg_match("/^(?=.*\d)(?=.*[a-za-z])[0-9a-za-z!@#$%]{4,12}/", $input_line, $output_array);
but:
- it works @ http://www.phpliveregex.com/p/byz
- it find first 4 elements
- why when try use page https://www.functions-online.com/preg_match.html shows 1 match?
using preg_match_all(), works
http://www.phpliveregex.com/p/bz0
# '/(?<!\s)(?i:[a-z\d]{4}|[a-z\d]{12})(?!\s)/' (?<! \s ) # whitespace boundary (?i: # case insensitive cluster group [a-z\d]{4} # 4 alnum | # or [a-z\d]{12} # 12 alnum ) (?! \s ) # whitespace boundary
Comments
Post a Comment