Hi,

Given the following regular expressions:
 - al...@[a-z]+\.[a-z]+
 - [a-...@[a-z]+\.[a-z]+
 - .*

The string [email protected] will obviously match all three regular 
expressions. In the application I am developing, we are only interested in the 
'most specific' match. In this case this is obviously the first one.
Unfortunately there seems no way to do this. A possible way would be to keep 
the regular expressions sorted on descending specificity and then simply take 
the first match. Of course then the next question would be how to sort the 
array of regular expressions. It is not an option to give the responsibility to 
the end-user to ensure that the array is sorted. So I hope you guys could help 
me out here...


Thanks !!


Paul


[Reference to stackoverflow question: 
http://stackoverflow.com/questions/3611860/determine-regular-expressions-specificity]



-- 
## List details at http://lists.exim.org/mailman/listinfo/pcre-dev 

Reply via email to