regex


smarty regex replace - remove unnecessary chars


I have to change string like "100,23 zł" and "29,23 $" to:
"100,23" "29,23"
So i want to remove all characters instead of numbers and ','
You can use a negated class containing only digits and comma:
[^0-9,]+
See demo on regex101.
I don't know how to do it with your language but it would be simple enough, just match anything that isn't a number or a comma and replace it with an empty string.
So match any non-digit character or a comma with: (\D|,)* or this [^0-9,]*
Replace with empty string: "" or '' depending on your language string delimiters .
you can replace this /\s\D+/ with empty string and this will do. This is applicable when you do not have any other content in the file. If you do have other contents too then try this /\d+\s\D+/

Related Links

How to detect a string which does not include " using flex?
Extract certain values from string in .txt files with PowerShell
Apache 301 Redirect Add language prefix if not present
Regex, match characters and doesn't contain more than one _ followed by another _
Regex ignore word
Regex not valid in google sheets error?
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

Categories

HOME
opencv
document
redirect
demandware
logstash
codenameone
openshift-origin
afp
gluon
openvpn
winsql
sony-camera-api
whitespace
documentation
android-vision
librsvg
openframeworks
openui5
nanotime
google-cloud-sdk
axios
apex
apache-kafka-streams
image-gallery
plc
eigen3
exe4j
freetype
pydev
jcrop
addthis
centos6
listbox
point-cloud-library
parallax.js
ocean
skyscanner
react-redux-form
server-sent-events
advanced-installer
deep-copy
outlook-vba
macvim
jetty-9
dsx
firedac
polymer-cli
edeliver
xargs
msysgit
gretl
dependency-management
docker-swarm-mode
simplesamlphp
xssf
fido
database-cleaner
complement
htc
infiniband
maven-versions-plugin
zenity
cabal-install
django-errors
tachyon
olingo
xpdf
hyperterm
python-3.1
app-engine-ndb
facebook-comments
egl
domo
post-processor
hjson
kindlegen
gulp-protractor
xerces
size-t
textmatching
sql-server-ce-3.5
movie
imake
chatjs
jasmin
imaging
android-menu
before-save
cellular-automata
mouseenter
jqgrid-php
requiredfieldvalidator
firebird2.1
kmz
couchpotato
angularjs-module
speaker
slimbox
datadesign
freeglut
tipsy
datatemplate
textboxlist
custom-tag
non-relational-database
iphone-sdk-3.1
code-statistics
virtual-server
shareware

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