Hello,
I noticed that in string.match and string.gsub I need to escape hyphens, i.e. instead of '-' to use '%-' to match a hyphen.
So to replace any hyphens in the matching pattern I used:
This worked fine in a plugin. However I tried doing the same thing from withing MUSH in a trigger (ctrl+shift+8) with Send To as script, and I found that it was not working because it was not escaping the hyphen anymore and even after 'string.gsub' 'match_string' was still "New-York" and not "New%-York" like in the plugin. How can I fix this?
Thanks.
I noticed that in string.match and string.gsub I need to escape hyphens, i.e. instead of '-' to use '%-' to match a hyphen.
So to replace any hyphens in the matching pattern I used:
match_string = "New-York"
match_string = string.gsub(match_string, "%-", "%%-")
city_match = string.match("I Love New-York", match_string)
This worked fine in a plugin. However I tried doing the same thing from withing MUSH in a trigger (ctrl+shift+8) with Send To as script, and I found that it was not working because it was not escaping the hyphen anymore and even after 'string.gsub' 'match_string' was still "New-York" and not "New%-York" like in the plugin. How can I fix this?
Thanks.