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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -