Regex for Special Characters in XQuery
Hi I am a java developer and from last few days I am working on OSB. I need to remove all spacial characters from a string. For this I tried following code in Assign block. if(exists($Variable) and not(empty($Variable/text())))then fn:replace(fn:replace(fn:replace(fn:replace( fn:replace($Variable/text(),'[$`,:%!##_-|]',''), '[$?~##!%:;=_+*]', ''), '[.]', ''), '[-]', ''), '[+= ?;]', '') else $Variable But I want to do this in a single Regex. All these characters are not working in a single Regex string. Is there any way to do this in single Regex string? I found a method functx:escape-for-regex but it is not working. Currently I am using Oracle 10g. I want something like this: "[^\\w-]|[$_-]" //It works in Java Thanks in advance.
There's no need for regular expressions to remove some characters from a blacklist, just use translate(...): translate($string, '-$`,:%!##_|]$?~##!%:;=_+*.-+= ?;', '') I didn't clean up the character list, though. The problem with your regexes is the dash in the list: [$`,:%!##_-|]. This regex is blocking all characters from _ (character 95) to | (character 124). This includes all lower-case letters! Always put the dash first: [-$`,:%!##_|]. Anyway: If possible, better use a whitelist. You will always be forgetting some characters. What about curly brackets?
What Perl matching regexp nuances can cause headaches?
What is the invalid URI error from SpamAssassin actually matching?
Validate postal cade using Regex on each character
VBA regex - match an expression that doesn't begin with a particular word
How to pass variable to regular expression in PERL
Batch rename screen shots on Mac OS X
US Phone regex that works in IE
Regex with lookaround for Lazarus
codeigniter regular expression for uri slug in routes
regex to match strings not preceded by a bang
What would the regex to match the hostname of this string?
How do I do a regex search and replace in sublime text 2?
Why are these regular expressions different?
r regex mileage
What is the complexity (Big-O) of searching an indexed data in mongoDB?
Filtering multiline pcregrep match with sed