Skip to content

Instantly share code, notes, and snippets.

@jgarciaruiz
Created January 25, 2018 11:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgarciaruiz/21392fdac25c8e30c5526c25a8f09538 to your computer and use it in GitHub Desktop.
Save jgarciaruiz/21392fdac25c8e30c5526c25a8f09538 to your computer and use it in GitHub Desktop.
fetch value between hashes
// fetch value between #
var string = "Chapter #1.0# and \r\n";
var regexChapter = new RegExp(/\#(.*?)\#/g);
var regexResult = regexChapter.exec(string)
console.log( regexResult );
if( regexResult != null ){
var chapterNumber = regexResult[1];
console.log("Chapter: "+chapterNumber);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment