Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
ECMAScript (JavaScript)

/
(^\|(?<tableSeparator>[\s\-|]+)\|\n)|(^\|\s*(?<tableTopFirst>[^|]+)(?=.*\n\|\s*-))|((?<!^)\|(?<tableTopMiddle>[^|\n]+)(?=\|.*\|\n\| -))|(\|(?<tableTopLast>[^|]+)\|\n(?=\|\s*-))|(^\|\s*(?<tableBottomFirst>[^|]+)(?=.*\n^[^|]))|((?<!^)\|(?<tableBottomMiddle>[^|\n]+)(?=\|.*\|\n[^|]))|(\|\s*(?<tableBottomLast>[^|]+)\|\n(?!\|))|(^\|\s*(?<tableMiddleFirst>[^|]+)(?=\|))|(\|\s*(?<tableMiddleLast>[^|]+)\|\n)|(\|\s*(?<tableMiddleMiddle>[^|]+))|!?(\[(?<text>[^(]+)]\((?<url>[^")]+))("(?<title>[^"]+)"|.*)\)|((?<!-.+\n)- (?<unorderedListFirstItem>.+)\n)|((?<=-.+\n)- (?<unorderedListMiddleItem>.+)\n(?=-))|(- (?<unorderedListLastItem>.+)\n(?!-))|((?<!\d+\..+\n)\d+\. (?<orderedListFirstItem>.+)\n)|((?<=\d+\..+\n)\d+\. (?<orderedListMiddleItem>.+)\n(?=\d+\.))|(\d+\. (?<orderedListLastItem>.+)\n(?!\d+\.))|(\*\*\*(?<boldAndItalic>[^*]*)\*\*\*)|(\*\*(?<bold>[^*]*)\*\*)|(\*(?<italic>[^*]*)\*)|(~~(?<strikethrough>[^~]*)~~)|(`{3}\n(?<multilineCode>[^`]+)`{3}\n)|(`(?<inlineCode>[^`\n]*)`)|(^#{6} (?<h6>.+))|(^#{5} (?<h5>.+))|(^#{4} (?<h4>.+))|(^#{3} (?<h3>.+))|(^#{2} (?<h2>.+))|(^# (?<h1>.+))|(?<horizontalLine>^-{3}\n)|(?<=^\n)> (?<singleLineQuote>.+)\n(?!^>)|((?<!> .+\n)> (?<quoteFirst>.+))|(> (?<quoteLast>.+)(?!.*\n> .+))|(> (?<quoteMiddle>.+))|(?<lineBreak>\n{2})
/
gm

Description

In order to neasting parsing work you need to run this regex multiple times on same target.

Submitted by Mateusz Budzisz - 2 years ago