title: Translating a Pygments regexp to JFlex
body: <p>I'm trying to build a lexer for Markdown in JFlex; I'm looking at the source for Pygments:</p>
  
  <p>For example, <a href="https://github.com/jhermann/pygments-markdown-lexer/blob/704b72bc6881e8c062593c01faacf8455b2fa159/src/pygments_markdown_lexer/lexer.py#L66" rel="nofollow noreferrer">this</a> is the rule for horizontal rule:</p>
  
  <pre><code>(r'^\s*\n(?:\s*[-*_]){3,}\s*\n', Markdown.Markup)
  </code></pre>
  
  <p>I'm naïvely writing this in my <code>.flex</code> file:</p>
  
  <pre><code>^\s*\n(?:\s*[-*_]){3,}\s*\n { return token(TokenType.KEYWORD2); }
  </code></pre>
  
  <p>This just gives me errors:</p>
  
  <pre class="lang-none prettyprint-override"><code>Error in file "/home/hhrutz/Documents/devel/SyntaxPane/src/main/jflex/de/sciss/syntaxpane/lexers/markdown.flex" (line 294): 
  Syntax error.
    ^\s*\n(?:\s*[-*_]){3,}\s*\n { return token(TokenType.KEYWORD2); }
           ^
  
  Error in file "/home/hhrutz/Documents/devel/SyntaxPane/src/main/jflex/de/sciss/syntaxpane/lexers/markdown.flex" (line 294): 
  Syntax error.
    ^\s*\n(?:\s*[-*_]){3,}\s*\n { return token(TokenType.KEYWORD2); }
                     ^
  
  Error in file "/home/hhrutz/Documents/devel/SyntaxPane/src/main/jflex/de/sciss/syntaxpane/lexers/markdown.flex" (line 294): 
  Unexpected character 
    ^\s*\n(?:\s*[-*_]){3,}\s*\n { return token(TokenType.KEYWORD2); }
                        ^
  JFlex.GeneratorException: Generation aborted
  </code></pre>