Unable to get regex working -
i have third party application lets me enter regular expression validate user input in text box. need user input data in format c:64gb, f:128gb h:32gb
. regex wrote:
\b[a-z]{1}[:]?\d*(gb|gb)\b
this regex works fine validates first block. if write c:64gb f:128
, marks input valid. not check f:128
makes input invalid. should c:64gb f:128gb
.
when change regex ^\b[a-z]{1}[:]?\d*(gb|gb)\b$
, allows me enter c:64gb
.
what doing wrong here?
you can use regex:
^(\w*[a-za-z]:?\d+(?:gb|gb)\w*)+$
Comments
Post a Comment