Let's say we have two regular expressions:
1234.*
and
.*
Input:
1234567
Obviously they both match, but 1234.* matches better since it is more specific. i.e. is more relevant. Is there a standard way for checking which is more relevant?
edit:
Some clarification. I want to make decisions by checking which regexp matches the input best. In this case I am only matching numbers.
Example with telephone numbers:
Input:
31882481337
We have a rule for each of the following regexps:
31.*
.*
In this scenario I would like the rule to be used that is bound to 31.* because that is more specific for the input given. If I was not using regexps it would be easy, because I could use a scoring mechanism to check how much it matches, however these rules may have some more advanced regexps, like:
31[89].*