mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-13 05:57:00 -04:00
fixed regex escaping bug, keywords with params are now no longer recognized if followed by an opening parenthesis
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@922 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -214,7 +214,7 @@ void Keyword::prepare(const vector<KeywordParamP>& param_types, bool force) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
regex += _("(") + regex_escape(text) + _(")");
|
regex += _("(") + regex_escape(text) + _(")");
|
||||||
regex = _("\\y") + regex + _("(?=$|[^a-zA-Z0-9])"); // only match whole words
|
regex = _("\\y") + regex + _("(?=$|[^a-zA-Z0-9\\(])"); // only match whole words
|
||||||
if (match_re.Compile(regex, wxRE_ADVANCED)) {
|
if (match_re.Compile(regex, wxRE_ADVANCED)) {
|
||||||
// not valid if it matches "", that would make MSE hang
|
// not valid if it matches "", that would make MSE hang
|
||||||
valid = !match_re.Matches(_(""));
|
valid = !match_re.Matches(_(""));
|
||||||
|
|||||||
+5
-3
@@ -422,9 +422,11 @@ String make_non_capturing(const String& re) {
|
|||||||
String ret;
|
String ret;
|
||||||
bool escape = false, bracket = false, capture = false;
|
bool escape = false, bracket = false, capture = false;
|
||||||
FOR_EACH_CONST(c, re) {
|
FOR_EACH_CONST(c, re) {
|
||||||
if (capture && c != _('?')) {
|
if (capture) {
|
||||||
// change this capture into a non-capturing "(" by appending "?:"
|
if (c != _('?')) {
|
||||||
ret += _("?:");
|
// change this capture into a non-capturing "(" by appending "?:"
|
||||||
|
ret += _("?:");
|
||||||
|
}
|
||||||
capture = false;
|
capture = false;
|
||||||
}
|
}
|
||||||
if (escape) { // second char of escape sequence
|
if (escape) { // second char of escape sequence
|
||||||
|
|||||||
Reference in New Issue
Block a user