perl regex to find any number that is a multiple of 5 -
perl regex find numbers multiple of 5.
i tried using =~ /[5]+/
finding numbers contains 5, not multiple of 5.
and find string length multiple of 5.
i answer second question: and find string length multiple of 5.
that more suitable regex number part (that has been answered), group 5 characters , match multiples of them
^(?:.{5})*$
see here on regexr
^
, $
matches start , end of string.
.{5}
matches 5 characters (except newlines when don't use s
modifier)
(?:.{5})*
repeats inner part of group 0 or more times ==> match on empty string! if don't want , start string length of @ least 5 use +
quantifier means 1 or more: ^(?:.{5})+$
Comments
Post a Comment