-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,372
  • 1
  • 8
  • 25

2 Answers2

0

You need a lazy quanitfier: *?

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

And if your string contains nested parenthesis:

(?'parens'\((?:[^\(]|\g'parens')*?\))
maraaaaaaaa
  • 7,749
  • 2
  • 22
  • 37
0

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

Mat Jones
  • 936
  • 1
  • 10
  • 27