Skip to content

Instantly share code, notes, and snippets.

@reimertz
Created September 7, 2022 14:37
Show Gist options
  • Save reimertz/b5bf45fa3aa5e1560fbf1ef83412e774 to your computer and use it in GitHub Desktop.
Save reimertz/b5bf45fa3aa5e1560fbf1ef83412e774 to your computer and use it in GitHub Desktop.
getSoundEditionNumber.js
const getSoundEditionNumber = (str) => {
const match = str.match(/#[0-9]+$/)
return match ? match[0].split('#')[1] : false
}
getSoundEditionNumber('An amazing track #1')
//"1"
getSoundEditionNumber('An amazing track #2')
//"2"
getSoundEditionNumber('An amazing track')
//false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment