I’m attempting to match the leading - characters in a Markdown list such as this:
--- What were the key things that drove me to make a switch? - No Database -- you - Tremendous Support -- the - Sane Folder Structure -- everything - Rapid Development -- there - Blog Post Folders -- granted - Asset Pipeline -- Grav - Twig — yes —
The regex that isn’t working looks like this:
{ name = 'text.html.markdown.list'; match = '(?<=\n)-(?= )|(?<!.)-(?= )'; },
What did I get wrong?
Bob ------------------- Robert J. Rockefeller Richmond Hill, GA www.bobrockefeller.com http://www.bobrockefeller.com/
On 9 Feb 2015, at 3:41, Bob Rockefeller wrote:
The regex that isn’t working looks like this:
{ name = 'text.html.markdown.list'; match = '(?<=\n)-(?= )|(?<!.)-(?= )'; },
What did I get wrong?
Use ^ instead of (?<=\n). The grammars only get a single line of context, so it can’t look at the line above.
If you need to avoid first line of the document (which your look-behind would do) then you can use: ^(?!\A).