deepak tiwari
deepak tiwari

Reputation: 107

Android studio regex - error while searching over whole project

Why am I getting a stackOverFlowError when running a regex to search a commented string?

regex:
/\*(?!\*)(?:.|\W)*?\*/

It's not giving an error when I search in a particular Java file, but it does when I search it over the whole project.

Upvotes: 1

Views: 437

Answers (1)

Avinash Raj
Avinash Raj

Reputation: 174706

I suggest you to change your regex like this,

\/\*(?!\*)[\s\S]*?\*\/

[\S\s]*? will match any space or non-space charcaters non-greedily. Thus it would match also the line-breaks.

Upvotes: 1

Related Questions