mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Fix Regex::replace_all to actually do something
This commit is contained in:
@@ -128,8 +128,7 @@ SCRIPT_FUNCTION_WITH_SIMPLIFY(replace) {
|
||||
SCRIPT_RETURN(replacer.apply(ctx, input));
|
||||
} else {
|
||||
// simple replacing
|
||||
replacer.match->replace_all(&input, replacer.replacement_string);
|
||||
SCRIPT_RETURN(input);
|
||||
SCRIPT_RETURN(replacer.match->replace_all(input, replacer.replacement_string));
|
||||
}
|
||||
}
|
||||
SCRIPT_FUNCTION_SIMPLIFY_CLOSURE(replace) {
|
||||
|
||||
+2
-4
@@ -24,10 +24,8 @@ void Regex::assign(const String& code) {
|
||||
}
|
||||
}
|
||||
|
||||
void Regex::replace_all(String* input, const String& format) {
|
||||
wxStdString std_string = toStdString(*input);
|
||||
regex_replace(std_string, regex, toStdString(format), boost::format_sed);
|
||||
*input = std_string;
|
||||
String Regex::replace_all(const String& input, const String& format) const {
|
||||
return regex_replace(toStdString(input), regex, toStdString(format), boost::format_sed);
|
||||
}
|
||||
|
||||
#else // USE_BOOST_REGEX
|
||||
|
||||
+1
-1
@@ -85,7 +85,7 @@
|
||||
inline bool matches(Results& results, const String::const_iterator& begin, const String::const_iterator& end) const {
|
||||
return regex_search(begin, end, results, regex);
|
||||
}
|
||||
void replace_all(String* input, const String& format);
|
||||
String replace_all(const String& input, const String& format) const;
|
||||
|
||||
inline bool empty() const {
|
||||
return regex.empty();
|
||||
|
||||
Reference in New Issue
Block a user