mirror of
https://github.com/godotengine/godot
synced 2024-09-18 20:11:29 +00:00
Exposed RegEx expanded option to scripts
This commit is contained in:
parent
bb3724a4cc
commit
f0d246a7bc
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
void RegEx::_bind_methods() {
|
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("find","text","start","end"),&RegEx::find, DEFVAL(0), DEFVAL(-1));
|
||||||
ObjectTypeDB::bind_method(_MD("clear"),&RegEx::clear);
|
ObjectTypeDB::bind_method(_MD("clear"),&RegEx::clear);
|
||||||
ObjectTypeDB::bind_method(_MD("is_valid"),&RegEx::is_valid);
|
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();
|
clear();
|
||||||
|
|
||||||
exp.compile(p_pattern.c_str());
|
exp.compile(p_pattern.c_str(), expanded);
|
||||||
|
|
||||||
ERR_FAIL_COND_V( !exp.valid(), FAILED );
|
ERR_FAIL_COND_V( !exp.valid(), FAILED );
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
bool is_valid() const;
|
bool is_valid() const;
|
||||||
int get_capture_count() const;
|
int get_capture_count() const;
|
||||||
String get_capture(int capture) 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;
|
int find(const String& p_text, int p_start = 0, int p_end = -1) const;
|
||||||
|
|
||||||
RegEx();
|
RegEx();
|
||||||
|
|
Loading…
Reference in a new issue