How do you express a regular expression where the string matches the following.
text, text, number
NOTE:
text = can be any amount of words or spaces.
number = most be 4 digit number.
the commas (,) must be matched too.
As an example, the following string is valid:
'Arnold Zend, Red House, 2551'
The regex pattern for that would be (the parenthesis are capture groups in-case you want to access the individual items:
It matches 2 names and a 4 digit number separated by a comma with the names being at-least 3 characters long. You can change the name character minimum if you’d like. And this is how to check if a string matches this pattern:
I have tested the expression with RegexTester and it works fine.