in javascript,can we match a string with circulate part by using regex but don't split it -
a string this: "01a123,02a13334,03a99313,01ba9424,……"
substring's regex is: /\d{2}[a-z]{1,2}\d*/
can write regex match string without split it?
to validate entire line of form,
# /^\d{2}[a-z]{1,2}\d*(?:,\d{2}[a-z]{1,2}\d*)*$/ ^ # beginning of string \d{2} [a-z]{1,2} \d* # 2 digits, 1-2 a-z, optional 0-many digits (?: # cluster group start (non-capture group) , # comma ',' \d{2} [a-z]{1,2} \d* # 2 digits, 1-2 a-z, optional 0-many digits )* # cluster group end, optional 0-many times $ # end of string
Comments
Post a Comment