Skip to content

Instantly share code, notes, and snippets.

@jwadhwani
Last active June 12, 2017 16:55
Show Gist options
  • Save jwadhwani/3ced698a6fd285fd14183bc66a2f98a7 to your computer and use it in GitHub Desktop.
Save jwadhwani/3ced698a6fd285fd14183bc66a2f98a7 to your computer and use it in GitHub Desktop.
REGEXP(JS): Replace one or more commas at the end of a string
let s= "AA,VV,FF,".replace( /,+$/, '');
console.log(s); //AA,VV,FF
let x = "AA,VV,FF,,".replace( /,+$/, '');
console.log(x); //AA,VV,FF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment