fix(regexp-utils): Fix urlLinkTagRegex bug

Regex was missing a `?`, so consumed all <a> tags on a single line. Fixed
to be non-greedy.
This commit is contained in:
Drew Regitsky 2016-03-10 18:41:01 -08:00
parent 42e5f4c605
commit 3f017892e0

View file

@ -51,7 +51,7 @@ RegExpUtils =
# 3. the rest of the opening a tag # 3. the rest of the opening a tag
# 4. the contents of the a tag # 4. the contents of the a tag
# 5. the closing tag # 5. the closing tag
urlLinkTagRegex: -> new RegExp(/(<a.*?href\s*?=\s*?['"])((?!mailto).+)(['"].*?>)([\s\S]*?)(<\/a>)/gim) urlLinkTagRegex: -> new RegExp(/(<a.*?href\s*?=\s*?['"])((?!mailto).+?)(['"].*?>)([\s\S]*?)(<\/a>)/gim)
# https://regex101.com/r/zG7aW4/3 # https://regex101.com/r/zG7aW4/3
imageTagRegex: -> /<img\s+[^>]*src="([^"]*)"[^>]*>/g imageTagRegex: -> /<img\s+[^>]*src="([^"]*)"[^>]*>/g