Skip to content

Instantly share code, notes, and snippets.

@justforuse
Created April 2, 2020 13:07
Show Gist options
  • Save justforuse/4087e3ff9d7d21d9854cf5dbd8ddc12d to your computer and use it in GitHub Desktop.
Save justforuse/4087e3ff9d7d21d9854cf5dbd8ddc12d to your computer and use it in GitHub Desktop.
Regular expression trim string spaces
// leading and trailing
reg = /\S.*\S/

// trailing
reg = /.*\S/

// leading
reg = /\S.*/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment