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?
extract substring using regex in shell script
Eclipse Add text to first line of all files
Renaming files by using a prefix from text file
Python regex to find words, which also excludes particular words
Regex - exclude search results
Update a line in the AD info field
Sed Match Number followed by string and return Number
Perl matching string with mix of alphanumeric,_ and any number of square braces [closed]
Bash: extract the scheme and host part from a URL string
RexExp find a word within a list of words that are within a parenthesis
Converting EBNF to Regular Expression
Regex rule - allow empty field or special format [duplicate]
Using powershell to search for a pattern
Check odd number of a certain character
Regex: unexpected double replacement [duplicate]
How do I use the sed command to remove all but the first three characters in a line?