Added RegEx::get_capture_start() method
This commit is contained in:
parent
334b3bc9b0
commit
e380ea8fac
|
@ -21,6 +21,7 @@ void RegEx::_bind_methods() {
|
||||||
ObjectTypeDB::bind_method(_MD("is_valid"),&RegEx::is_valid);
|
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_count"),&RegEx::get_capture_count);
|
||||||
ObjectTypeDB::bind_method(_MD("get_capture","capture"),&RegEx::get_capture);
|
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);
|
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, String() );
|
||||||
|
|
||||||
|
return captures[capture].start;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Error RegEx::compile(const String& p_pattern, int capture) {
|
Error RegEx::compile(const String& p_pattern, int capture) {
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|
|
@ -35,6 +35,7 @@ public:
|
||||||
void clear();
|
void clear();
|
||||||
bool is_valid() const;
|
bool is_valid() const;
|
||||||
int get_capture_count() const;
|
int get_capture_count() const;
|
||||||
|
int get_capture_start(int capture) const;
|
||||||
String get_capture(int capture) const;
|
String get_capture(int capture) const;
|
||||||
Error compile(const String& p_pattern, int capture = 9);
|
Error compile(const String& p_pattern, int capture = 9);
|
||||||
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;
|
||||||
|
|
Loading…
Reference in New Issue