javascript – Regex to match text between variable string and quotation marks
I am trying to write up regex to match text that appears after the word Example, in some cases this could be written as Examples.
I want to return all the text that appears between Examples(s) and [text]
, ending with the last the quotation marks.
Sample Text:
"In this kata you are required to, given a string, replace every letter with its position in the alphabet. If anything in the text isn't a letter, ignore it and don't return it. `'a' = 1`, `'b' = 2`, etc. ## Example <!-- unlisted languages will use the first entry. please keep python up top. --> ```python alphabet_position('The sunset sets at twelve o' clock.') ``` ```crystal alphabet_position('The sunset sets at twelve o' clock.') ``` Should return `20 8 5 19 21 14 19 5 20 19 5 20 19 1 20 20 23 5 12 22 5 15 3 12 15 3 11` ( as a string )"
Expected output:
<!-- unlisted languages will use the first entry. please keep python up top. --> ```python alphabet_position('The sunset sets at twelve o' clock.') ```
Attempted solution:
const matched = test.match('Example(.)(.*)```(.*)```')
However this returns nothing (blank)
Read more here: Source link