regex


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?

Related Links

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?

Categories

HOME
amazon-s3
asp.net-mvc
vr
angular2-forms
pyqt5
varnish
youtube
passwords
runtime-error
turing
redhat
addeventlistener
winsql
delphi-xe7
c++14
jbpm
r-caret
graphengine
scrollbar
tapi
highlight
yii2-advanced-app
rebus
image-gallery
w2ui
vast
accelerated-mobile-page
centroid
csom
robotium
symbolic-math
addthis
vnc
structure
scalability
toolbar
number-formatting
phonegap-desktop-app
dapper-fastcrud
pyparsing
django-users
dlopen
sqlite.swift
haxm
nav
double-click-advertising
increment
texture-mapping
dsx
brainfuck
angular2-seed
monogame
angularjs-routing
strip-tags
federation
orchestrate
recurrence
canopen
easyhook
flying-saucer
nuget-package-restore
manifoldcf
android-alertdialog
informatica-cloud
ispconfig
hapi.js
kernighan-and-ritchie
vlc-android
webdeploy-3.5
python-3.1
illegalstateexception
sqlj
dbfit
ospf
sejda
openocd
hjson
spymemcached
esky
maven-cargo
textmatching
zim-database
spiceworks
jasmin
boxapiv2
liferay-hook
private-methods
email-spam
populate
micro-orm
nsimageview
wow64
dependency-walker
symfony-2.2
arden-syntax
graphiti-js
ekeventkit
postgresql-8.1
sharepoint-timer-job
paredit
nstreecontroller
remote-control
excel-web-query
project-settings
database-dump
shareware
usenet

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App