Module:String: Difference between revisions
From Test Wiki
Content deleted Content added
Justman10000 (talk | contribs) m 1 revision imported: API testing |
|||
| Line 407: | Line 407: | ||
if plain then |
if plain then |
||
pattern = str._escapePattern( pattern ) |
pattern = str._escapePattern( pattern ) |
||
replace = |
replace = string.gsub( replace, "%%", "%%%%" ) --Only need to escape replacement sequences. |
||
end |
end |
||
| Line 583: | Line 583: | ||
]] |
]] |
||
function str._escapePattern( pattern_str ) |
function str._escapePattern( pattern_str ) |
||
return |
return ( string.gsub( pattern_str, "[%(%)%.%%%+%-%*%?%[%^%$%]]", "%%%0" ) ) |
||
end |
end |
||