Commit b61f4bc2 authored by coppro's avatar coppro

Fixed "regex escape" function, and updated a script that needed it.

parent 5df8caf6
mse version: 0.3.5 mse version: 0.3.5
short name: Magic short name: Magic
full name: Magic the Gathering full name: Magic the Gathering
icon: card-back.png icon: card-back.png
...@@ -112,7 +112,7 @@ init script: ...@@ -112,7 +112,7 @@ init script:
text_to_color := { text_to_color := {
# Note: running filter_text is quite slow, do a quick 'contains' check first # Note: running filter_text is quite slow, do a quick 'contains' check first
if contains(match: card_name) then ( if contains(match: card_name) then (
text := filter_text(match: card_name+"(</[-a-z]+>)? is (colorless|all colors|((blue|white|green|red|black)((,|,? and) (blue|white|green|red|black))*))\\.") text := filter_text(match: regex_escape(card_name)+"(</[-a-z]+>)? is (colorless|all colors|((blue|white|green|red|black)((,|,? and) (blue|white|green|red|black))*))\\.")
if text != "" then ( if text != "" then (
if contains(text, match: "all colors") then ( if contains(text, match: "all colors") then (
colors := "WUBRG" colors := "WUBRG"
......
...@@ -610,7 +610,7 @@ void init_script_basic_functions(Context& ctx) { ...@@ -610,7 +610,7 @@ void init_script_basic_functions(Context& ctx) {
ctx.setVariable(_("format"), script_format); ctx.setVariable(_("format"), script_format);
ctx.setVariable(_("format rule"), script_format_rule); ctx.setVariable(_("format rule"), script_format_rule);
ctx.setVariable(_("curly quotes"), script_curly_quotes); ctx.setVariable(_("curly quotes"), script_curly_quotes);
ctx.setVariable(_("regex_escape"), script_regex_escape); ctx.setVariable(_("regex escape"), script_regex_escape);
// tagged string // tagged string
ctx.setVariable(_("tag contents"), script_tag_contents); ctx.setVariable(_("tag contents"), script_tag_contents);
ctx.setVariable(_("remove tag"), script_tag_remove); ctx.setVariable(_("remove tag"), script_tag_remove);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment