aboutsummaryrefslogtreecommitdiffstats
path: root/markdown.py
diff options
context:
space:
mode:
authorDavid Wolever <wolever@cs.toronto.edu>2008-02-29 22:22:39 +0000
committerDavid Wolever <wolever@cs.toronto.edu>2008-02-29 22:22:39 +0000
commit34c680a61d0bd83d6b21596e9a086e7db73706e1 (patch)
tree8f265a5db12144eb70912c18716bf1523f085906 /markdown.py
parentc33803ad2e84cdce6e4ebf2c66d450216aefbe7f (diff)
downloadmarkdown-34c680a61d0bd83d6b21596e9a086e7db73706e1.tar.gz
markdown-34c680a61d0bd83d6b21596e9a086e7db73706e1.tar.bz2
markdown-34c680a61d0bd83d6b21596e9a086e7db73706e1.zip
Fixed bugs involving greedy/non-greedy regexes
Diffstat (limited to 'markdown.py')
-rw-r--r--markdown.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/markdown.py b/markdown.py
index 1681a98..97038ba 100644
--- a/markdown.py
+++ b/markdown.py
@@ -686,19 +686,19 @@ BRK = ( r'\[('
NOIMG = r'(?<!\!)'
BACKTICK_RE = r'\`([^\`]*)\`' # `e= m*c^2`
-DOUBLE_BACKTICK_RE = r'\`\`(.*)\`\`' # ``e=f("`")``
+DOUBLE_BACKTICK_RE = r'\`\`(.*?)\`\`' # ``e=f("`")``
ESCAPE_RE = r'\\(.)' # \<
EMPHASIS_RE = r'\*([^\*]*)\*' # *emphasis*
-STRONG_RE = r'\*\*(.*)\*\*' # **strong**
-STRONG_EM_RE = r'\*\*\*([^_]*)\*\*\*' # ***strong***
+STRONG_RE = r'\*\*(.*?)\*\*' # **strong**
+STRONG_EM_RE = r'\*\*\*(.*?)\*\*\*' # ***strong***
if SMART_EMPHASIS:
EMPHASIS_2_RE = r'(?<!\S)_(\S[^_]*)_' # _emphasis_
else:
EMPHASIS_2_RE = r'_([^_]*)_' # _emphasis_
-STRONG_2_RE = r'__([^_]*)__' # __strong__
-STRONG_EM_2_RE = r'___([^_]*)___' # ___strong___
+STRONG_2_RE = r'__(.*?)__' # __strong__
+STRONG_EM_2_RE = r'___(.*?)___' # ___strong___
LINK_RE = NOIMG + BRK + r'\s*\(([^\)]*)\)' # [text](url)
LINK_ANGLED_RE = NOIMG + BRK + r'\s*\(<([^\)]*)>\)' # [text](<url>)
@@ -718,7 +718,7 @@ class Pattern:
def __init__ (self, pattern):
self.pattern = pattern
- self.compiled_re = re.compile("^(.*)%s(.*)$" % pattern, re.DOTALL)
+ self.compiled_re = re.compile("^(.*?)%s(.*?)$" % pattern, re.DOTALL)
def getCompiledRegExp (self):
return self.compiled_re