What is `/[^0-9a-z]/` and `/\W/g`?

I have used /[^0-9a-z]/ and /\W/g in palindrome challenge i.e. str.replace(/[^0-9a-z]/gi,’’)
I know how replace works, but I don’t know everything about this /[^0-9a-z]/
Can someone explain me each and every character of this??

2 Likes

Cannot recommend this series highly enough, helped me finally understand and love regexp

https://www.youtube.com/watch?v=7DG3kCDx53c&list=PLRqwX-V7Uu6YEypLuls7iidwHMdCM6o2w

2 Likes

This tutorial could help you out.
https://regexone.com/

2 Likes