Answers for "removes whitespace from both sides of a string using regex in html input field in js code"

0

remove whitespace with regex javascript

return str.replace(/\s/g, '');
Posted by: Guest on November-29-2020
0

JavaScript Regex - Remove Whitespace from Start and End

let hello = "   Hello, World!  ";
let wsRegex = /^\s+|\s+$/g; 
let result = hello.replace(wsRegex, "");
Posted by: Guest on February-04-2022

Code answers related to "removes whitespace from both sides of a string using regex in html input field in js code"

Code answers related to "Javascript"

Browse Popular Code Answers by Language