Skip to content

Instantly share code, notes, and snippets.

@qwersk
Created May 24, 2017 03:00
Show Gist options
  • Save qwersk/bd453160515275973e7b3d80c3e63ce7 to your computer and use it in GitHub Desktop.
Save qwersk/bd453160515275973e7b3d80c3e63ce7 to your computer and use it in GitHub Desktop.
TRIM CHAR IN STRING #JS #JAVASCRIPT
var x = '|f|oo||';
var y = x.replace(/^\|+|\|+$/g, '');
document.write(x + '<br />' + y);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment