From ef005d4f64d2ee2b35185d4fbdf2aea684cd4966 Mon Sep 17 00:00:00 2001 From: Lee Zher Huei Date: Fri, 24 Jul 2015 01:18:46 +0100 Subject: Regex library Nrex initial port --- drivers/nrex/regex.cpp | 112 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 drivers/nrex/regex.cpp (limited to 'drivers/nrex/regex.cpp') diff --git a/drivers/nrex/regex.cpp b/drivers/nrex/regex.cpp new file mode 100644 index 000000000..d7c12bd54 --- /dev/null +++ b/drivers/nrex/regex.cpp @@ -0,0 +1,112 @@ +/*************************************************/ +/* regex.cpp */ +/*************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/*************************************************/ +/* Source code within this file is: */ +/* (c) 2007-2010 Juan Linietsky, Ariel Manzur */ +/* All Rights Reserved. */ +/*************************************************/ + +#include "regex.h" +#include "nrex.hpp" +#include "core/os/memory.h" + +void RegEx::_bind_methods() { + + ObjectTypeDB::bind_method(_MD("compile","pattern"),&RegEx::compile); + ObjectTypeDB::bind_method(_MD("match","text","start","end"),&RegEx::match, DEFVAL(0), DEFVAL(-1)); + ObjectTypeDB::bind_method(_MD("get_capture","capture"),&RegEx::get_capture); + ObjectTypeDB::bind_method(_MD("get_capture_list"),&RegEx::_bind_get_capture_list); + +}; + +StringArray RegEx::_bind_get_capture_list() const { + + StringArray ret; + int count = get_capture_count(); + for (int i=0; i