I need to capture all lines starting with the #
character in JavaScript. I tried using something like the following regex, but it turns out that JavaScript doesn't support positive lookbehind assertion (?<=)
.
/(?<=\n)\#[^\n]*/g
How can I transform this regular expression into something supported by JavaScript?
You can use:
/^ *#(.*)$/m
And capture match[1]
for text after #