With this regex: \((\W*\d*\W*)*\)
I am looking for numbers inside brackets. These numbers can be surrounded by any symbols but not characters and this pattern can appear a lot of times inside brackets, I mean I need to match everything here:
but NOT:
and exactly the last example gives me a Catastrophic backtracking error. How can I avoid this error? I really don't understand how to do it...
You could change your regex to \([\W\d]*\)
which will match and not match your examples.