Differences between the replacement (/ [^ a-z0-9] / gi, '') and the replacement (/ [^ a-zA-Z0-9] / g, '')

Are there any differences between the two?

replace(/[^a-z0-9]/gi, '');
replace(/[^a-zA-Z0-9]/g, '');

In addition, are there any significant differences in time using this or that?

edit: about performance, I did some testing http://jsperf.com/myregexp-test

+5
source share
1 answer

No, at first iin the end it makes the case insensitive, which does not matter if the letter it finds is upper or lower case.

, , . , .

+5

All Articles