-1

Here's my current setup: (image showing regexr-highlighted strings)

My regexp match is Skript\.register(effect|expression|event|condition)\((.*)\)\;

Basically, I want to match all methods from a source code file that start with Skript.registerwhatever.( and end with );, but the problem is the code can go multiline. If I change (.*) to ([\s\S]*), it completely wrecks and matches everything until the very last );.

Community
  • 1
  • 1
user7401478
  • 1,269
  • 1
  • 7
  • 21

2 Answers2

0

You need a lazy quanitfier: *?

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

And if your string contains nested parenthesis:

(?'parens'\((?:[^\(]|\g'parens')*?\))
maraaaaaaaa
  • 7,355
  • 2
  • 19
  • 33
0

You need to escape parenthesis in regex because they are reserved symbols. Try \(.*\)

Mat Jones
  • 905
  • 1
  • 10
  • 27