string - Represent an ID code in regex -
i learned regex couple of days ago , , expand knowledge bit , match id code has letter first letter , sec letter may letter or integer . id_code has 2 letters long .
a{“a”-“z”|”0”-“9”} general representation of trying achieve,
so far got sec letter. need match first letter , sec letter in case it's number .
string.matches("-?[a-z]+")
this not homework or grade btw
there few ways this. favourite a[a-za-z0-9]
because think readable way of managing it, though a[\d\w]
quite graceful too.
regex string
No comments:
Post a Comment