Skip to content

Instantly share code, notes, and snippets.

@ooca-big
Created April 24, 2020 07:47
Show Gist options
  • Select an option

  • Save ooca-big/df09b346744d17fd7f3aa9dc19c084be to your computer and use it in GitHub Desktop.

Select an option

Save ooca-big/df09b346744d17fd7f3aa9dc19c084be to your computer and use it in GitHub Desktop.
replace multiple spaces
let input = ` a adf asdfasdfa sasdf asf asdf adsf a asdfa sasdfasdf
asdf sa sfd
sadfi asdf asdfa asdf adf asdfasdf asdf asdf813rkj ฟวห่กดาสฟ ืหกด ฟกด
หกดฟฟหก ฟหด ่ฟ
ฟห covid--19`
console.log(input.replace(/[\-_\.\*\+\/\#\$\@\ \t]{2,}/g, '').replace(/\n{2,}/g, '\n'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment