У меня есть файл со списком функций и глобальных постоянных переменных.
const native func foo takes nothing returns nothing
const native func bar takes nothing returns nothing
public
const boolean foo1 = false
const boolean bar1 = true
// etc etc ..... (comment line)
const text foo68 = "Hello"
const text bar69 = "World"
const int _pi = 3.14159265359
const int _tau = 2*_pi
endpublic
const native func xxx takes text str returns boolean
const native func yyy takes int val returns text
native func zzz takes float val returns int
public
// check if it works for multiple public.
const text heh = "hello"
const text hehe = zero
endpublic
const native func qqq takes text str returns int
Это мое текущее регулярное выражение.
(?:const\s+\w+\s+)(\w+)
Моя цель - получить имя переменной внутри public
и endpublic
.
Результат должен быть таким:
foo1
bar1
foo68
bar69
heh
hehe
Можно ли сопоставить строку внутри указанных c open и закрывающий тег? Если да, то как?