diff options
Diffstat (limited to 'drivers/nrex/regex.cpp')
-rw-r--r-- | drivers/nrex/regex.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/nrex/regex.cpp b/drivers/nrex/regex.cpp index 459cf28e1e..5d6c9583ef 100644 --- a/drivers/nrex/regex.cpp +++ b/drivers/nrex/regex.cpp @@ -21,6 +21,7 @@ void RegEx::_bind_methods() { ObjectTypeDB::bind_method(_MD("is_valid"),&RegEx::is_valid); ObjectTypeDB::bind_method(_MD("get_capture_count"),&RegEx::get_capture_count); ObjectTypeDB::bind_method(_MD("get_capture","capture"),&RegEx::get_capture); + ObjectTypeDB::bind_method(_MD("get_capture_start","capture"),&RegEx::get_capture_start); ObjectTypeDB::bind_method(_MD("get_captures"),&RegEx::_bind_get_captures); }; @@ -68,6 +69,14 @@ String RegEx::get_capture(int capture) const { } +int RegEx::get_capture_start(int capture) const { + + ERR_FAIL_COND_V( get_capture_count() <= capture, -1 ); + + return captures[capture].start; + +} + Error RegEx::compile(const String& p_pattern, int capture) { clear(); |