I am trying to replace with a blank all characters except numbers, but this doesn't works:
s.replace(/(?!\d)/g, '')
Thanks!
Use negative character classes:
s.replace(/[^0-9]+/g, '')
or s.replace(/[^\d]+/g, '')
or s.replace(/\D+/g, '')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With