Guest User

Untitled

a guest
Jul 16th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. <cfscript>
  2.  
  3. function escapeSpecialChars(required string term) {
  4. return reReplace(term, '([\[\]])', '\\\1', 'all');
  5. }
  6.  
  7. function test(actual,expected) {
  8. writeDump({
  9. expected: expected,
  10. got: actual
  11. });
  12. }
  13.  
  14.  
  15. test(escapeSpecialChars("[]"), "\\[\\]");
  16.  
  17.  
  18. </cfscript>
Add Comment
Please, Sign In to add comment