Created
January 25, 2018 11:32
-
-
Save jgarciaruiz/21392fdac25c8e30c5526c25a8f09538 to your computer and use it in GitHub Desktop.
fetch value between hashes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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