Link | lp_regexp_encode |
Author | Bil Corry |
Category | Technical |
Version | 8.x |
License | Public Domain |
Posted | 06 Dec 2005 |
Updated | 06 Dec 2005 |
More by this author... |
Returns regexp hex-encoded text. Use to avoid passing special regexp chars into the regexp engine.
Requires [lp_string_ucs]
''; var:'search' = (:'ä','dog','++','\\','$'); var:'text' = 'This is a test $string with special regexp ä characters \\dog test. ++'; 'Text = ' $text '';
'; iterate: $search, local:'s'; var:'encode' = lp_regexp_encode: #s; '-' * 60 '\r\n'; 'Search = ' #s '\r\n'; 'Encode = ' $encode '\r\n'; 'Found = ' (string_findregexp: $text, -find=$encode, -ignorecase) '\r\n'; /iterate; '
Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
[ define_tag:'lp_regexp_encode', -description='Returns regexp hex-encoded text.', -priority='replace', -required='text'; // use to avoid passing special regexp chars into the regexp engine // http://www.pcre.org/pcre.txt local:'return' = string; // encode regexp chars iterate: #text, local:'char'; #return += '\\x{' (lp_string_ucs: #char, -hex) '}'; /iterate; return: @#return; /define_tag; ]
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft