I'm using the following regular expression to validate email addresses:
([_A-Za-z0-9-+]+(.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(.[A-Za-z0-9]+)*(.[A-Za-z]{2,})$)
but I am getting Catastrophic Backtracking in Regular Expression when the string is:
abc@damkovnai.un;efg@damkovnai.un;hij.kumar@damkovnai.un;klm.verma@damkovnai.un;
When I remove the last semicolon, the result is true
, but when the semicolon exist in last position in the string then the output is Catastrophic Backtracking, even though I want the result to be false
.