diff options
author | Zher Huei Lee <lee.zh.92@gmail.com> | 2015-10-20 10:05:55 +0100 |
---|---|---|
committer | Zher Huei Lee <lee.zh.92@gmail.com> | 2015-11-07 11:03:24 +0000 |
commit | f0d246a7bce9f8f22e9886d474f1758e0c20d8cb (patch) | |
tree | 74400ddb98abe7848685f7364da46dc4f4c56774 /drivers/nrex | |
parent | bb3724a4cc737599d5b12abeb8b1590781bb5ddb (diff) |
Exposed RegEx expanded option to scripts
Diffstat (limited to 'drivers/nrex')
-rw-r--r-- | drivers/nrex/regex.cpp | 6 | ||||
-rw-r--r-- | drivers/nrex/regex.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/drivers/nrex/regex.cpp b/drivers/nrex/regex.cpp index 2707249a6e..246384b10a 100644 --- a/drivers/nrex/regex.cpp +++ b/drivers/nrex/regex.cpp @@ -15,7 +15,7 @@ void RegEx::_bind_methods() { - ObjectTypeDB::bind_method(_MD("compile","pattern"),&RegEx::compile); + ObjectTypeDB::bind_method(_MD("compile","pattern", "expanded"),&RegEx::compile, DEFVAL(true)); ObjectTypeDB::bind_method(_MD("find","text","start","end"),&RegEx::find, DEFVAL(0), DEFVAL(-1)); ObjectTypeDB::bind_method(_MD("clear"),&RegEx::clear); ObjectTypeDB::bind_method(_MD("is_valid"),&RegEx::is_valid); @@ -68,11 +68,11 @@ String RegEx::get_capture(int capture) const { } -Error RegEx::compile(const String& p_pattern) { +Error RegEx::compile(const String& p_pattern, bool expanded) { clear(); - exp.compile(p_pattern.c_str()); + exp.compile(p_pattern.c_str(), expanded); ERR_FAIL_COND_V( !exp.valid(), FAILED ); diff --git a/drivers/nrex/regex.h b/drivers/nrex/regex.h index 0626029705..be52da8149 100644 --- a/drivers/nrex/regex.h +++ b/drivers/nrex/regex.h @@ -36,7 +36,7 @@ public: bool is_valid() const; int get_capture_count() const; String get_capture(int capture) const; - Error compile(const String& p_pattern); + Error compile(const String& p_pattern, bool expanded = false); int find(const String& p_text, int p_start = 0, int p_end = -1) const; RegEx(); |