Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <cfscript>
- function escapeSpecialChars(required string term) {
- return reReplace(term, '([\[\]])', '\\\1', 'all');
- }
- function test(actual,expected) {
- writeDump({
- expected: expected,
- got: actual
- });
- }
- test(escapeSpecialChars("[]"), "\\[\\]");
- </cfscript>
Add Comment
Please, Sign In to add comment