java - Groovy regexp doesn't work -
using groovy want match on following: 1 word followed "." followed number.
assert 'randomword.[0-9]+' ==~ 'randomword.1' assert 'randomword.[0-9]+' ==~ 'randomword.123' assert 'randomword.[0-9]+' =~ 'randomword.1' assert 'randomword.[0-9]+' =~ 'randomword.123' assert 'randomword\\.[0-9]+' =~ 'randomword.1'
none of above works, can explain me why , show me way right?
the correct syntax be:
assert 'randomword.123' =~ /randomword\.[0-9]+/