vendredi 19 août 2016

Catastrophic backtracking issue

I am running into an issue with a regex pattern when no match is found.

The regex pattern that I use is:

^(?:".*?",){4}"(?:.*?)Cookie:\s(?:.*?)Routing=(.*?);

As test data I use something in the likes of:

"a","b","c","d","POST: /portal/start.asp HTTP/1.1\r\nHost: myhost\r\nCookie: w1n0_er=xxxx; routxing=yyyy;"x","x","x","x","x","x","x","x","x","x","x","x","x","x","x","x","x",

When the 'routing' parameter is found, all works well. However, when the routing parameter is not found by excluding it from the test data, the regex keeps searching. I found out by other posts that this is caused by catastrophic backtracking but I cannot seem to find a way to avoid it.

Aucun commentaire:

Enregistrer un commentaire