Skip to content
This repository was archived by the owner on Nov 1, 2017. It is now read-only.

Commit 9bd8e69

Browse files
committed
Simplify the regex a little bit
1 parent 765f60f commit 9bd8e69

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

app/assets/javascripts/task_list.coffee

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,12 @@ itemPattern = ///
126126
#{escapePattern(incomplete)}
127127
)
128128
\s+ # is followed by whitespace
129-
( # followed by anything unmistakable for a link,
130-
([^\[\(]|$) # or end of line
131-
|
132-
(?!
133-
\(.*?\) # or, not immediately followed by a link URL
134-
)
135-
( # and not part of a link reference
136-
(\[.*?\]\s*(\[.*?\]|\(.*?\))\s*)+
137-
([^\[]|$)
138-
)
129+
(?!
130+
\(.*?\) # is not part of a [foo](url) link
131+
)
132+
(?= # and is followed by zero or more links
133+
(?:\[.*?\]\s*(?:\[.*?\]|\(.*?\))\s*)*
134+
(?:[^\[]|$) # and either a non-link or the end of the string
139135
)
140136
///
141137

0 commit comments

Comments
 (0)