Thursday 15 April 2010

python - Regular expression - Set of possible character matches -


I need to check a regular expression for a set of possible character matches,

Field 'Test' can take these possible values ​​- 'TEST1', 'TEST2', 'TEST3' ... 'TEST10' import re-pattern = 'test [0123456789] field = 'TEST1' match =

How do I specify the value of [10] in pattern matching?

  test (?: [1-9] | 10) \ b   

This fixes some scenarios which the other answer was not here.

In action:

No comments:

Post a Comment