+ 1

How can I remove unwanted characters from string using javascript đŸ€”

String="how$a%r#e yo&u?"; How can I remove all of the symbols from this string using javascript.đŸ€”?

16th Jan 2022, 2:54 AM
Mohammed Nihal
Mohammed Nihal - avatar
2 Answers
+ 5
U can use String.replace(regex , placeholder) var Sring="how$a%r#e yo&u?"; console.log(Sring.replace(/[^a-zA-Z ]/g , '')) Removing all special character
16th Jan 2022, 3:20 AM
Pariket Thakur
Pariket Thakur - avatar
+ 2
Pariket Thakur thank you 😊
16th Jan 2022, 3:28 AM
Mohammed Nihal
Mohammed Nihal - avatar