mirror of
https://github.com/albertodemichelis/squirrel.git
synced 2026-01-12 06:28:43 +01:00
Add a new matching rule \m that behaves similar to lua %b, it matches a balanced open and close characters ex:
\m() <- will match a balanced pair of ( and )
\m{} <- will match a balanced pair of { and }
See lua %b for more info.
Also include a nut file as example.
11 lines
352 B
Plaintext
11 lines
352 B
Plaintext
local ex = regexp("[a-zA-Z]+");
|
|
local string = "123 Test; strlen(str);";
|
|
local res = ex.search(string);
|
|
print(string.slice(res.begin,res.end)); //prints "Test"
|
|
print("\n");
|
|
ex = regexp(@"\m()");
|
|
string = "123 Test; doSomething(str, getTemp(), (a+(b/c)));";
|
|
res = ex.search(string);
|
|
print(string.slice(res.begin,res.end)); //prints "(...)"
|
|
print("\n");
|