Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Inverse regex javascript

I'm trying to remove everything in a string that does not match 'standard' characters. Heres what I have so far:

var result = myString.replace(/^(?![A-Za-z0-9]+)/g, '');

Which does not work. Can someone point to me what I'm not doing right?

like image 603
Eric Avatar asked Dec 12 '25 08:12

Eric


1 Answers

I think you mean this:

var result = myString.replace(/[^a-z0-9]/gi,'');
like image 181
Niet the Dark Absol Avatar answered Dec 13 '25 21:12

Niet the Dark Absol



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!