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

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

Categories

HOME
azure
flutter
document
clojure
magento
auth0
x-editable
spring-roo
python-3.5
anylogic
feed
redhat
angular-mdl
android-bluetooth
hadoop2
square-connect
xorg
executable
avr
watchservice
records
api-design
jpos
opencms
similarity
aspdotnetstorefront
easendmail
precision
esri
nested-loops
f2py
codeceptjs
android-imageview
google-shared-contacts
detach
nib
pdfstamper
sieve-of-eratosthenes
dwm
vue2
protobuf-3
gradle-tooling-api
hostname
win2d
php-deployer
virtualmin
pci
autofocus
strip-tags
sql-mode
gcc4.8
android-camera-intent
cakephp-2.3
bootstrap-slider
coldfusion-11
data-fitting
texture2d
geneos
radix-sort
sejda
cocoon-gem
easynetq
targetinvocationexception
min3d
opensc
knockout-mvc
pkcs#10
fig
xsltforms
parsekit
modx-evolution
couchrest
libtorrent-rasterbar
prudentia
apache-commons-dbcp
flash-cs4
python-dateutil
slimbox
northwind
layout-manager
cassette
locomotivejs
ariatemplates
expressionvisitor
ladon
boost-gil
nntp
indextank
automapping
webshop
utility
corporate-policy

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