-1

How do I use replace regex in JavaScript to get rid of everything that's not a letter, number or space in a sentence?

var string = "here is a sentence with letters and numbers and symbols 123!@#";
1

1 Answer 1

1

var string = "here is a sentence with letters and numbers and symbols 123!@#";

var x = string.replace(/[^a-zA-Z0-9 ]/g,'')
console.log(x)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.