I have two pairs of regular expressions which I would like to test to see if they match the same data

Viewed 45

EDIT: the first regex is used only to validate the input. The second one is then used to tell if we should disregard the first part (using split by \s) or not - hence the change to startsWith.

I have inherited code that has to check codes that match a specific regex:

[A-Za-z0-9 -]+(?:[A-Za-z0-9*])$

I changed this to remove the regex group. Now I would like to test that is the same as the regex above.

[A-Za-z0-9 -]+[A-Za-z0-9*]$

how would I test this without running all the permutations in the world?

0 Answers
Related