java - Regex match digits, comma and semicolon? -


What is a regular expression that matches the string in which the digits 0 to 9, a comma, and a semi-colon ? I'm looking to use it in Java:

  word.matches ("^ [[1-9,;] $") // or something like that ...   

I am new to regular expressions.

You almost are, you just left 0 and forgot the quantifier.

  word.matches ("^ [0-9,;] + $")    

Comments