Boo
  1. Boo
  2. BOO-437

allow curly braces in regex literals

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: 0.5.6
    • Fix Version/s: 0.6
    • Component/s: Parser
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Add '

      {' and '}

      ' to the RE_ESC rule in boo.g and booel.g to allow the use of curly braces in regex literals like so:

      s = """stuff {

      { code }

      } omg

      { more }

      pwn"""

      mc = /(?<Unable to render embedded object: File (\\){(\\\{) not found.\\){.*(?<Unable to render embedded object: File (\\)})*(?<) not found.
      )}/.Matches(s)

      for i in range(mc.Count):
      print mc[i].Value

        Activity

        Hide
        Doug H added a comment -

        Actually I noticed the pattern works if you don't escape the curly braces and use @:
        mc = @/(?<!\\){(

        {|\\}

        |[^{}]|(?<!
        )

        {.*(?<!\\)}

        )*(?<!
        )}/.Matches(s)

        but if you do make these little additions to boo.g and booel.g, both forms work (escape and non-escaped curly braces)

        Show
        Doug H added a comment - Actually I noticed the pattern works if you don't escape the curly braces and use @: mc = @/(?<!\\){( {|\\} | [^{}] |(?<! ) {.*(?<!\\)} )*(?<! )}/.Matches(s) but if you do make these little additions to boo.g and booel.g, both forms work (escape and non-escaped curly braces)
        Hide
        Rodrigo B. de Oliveira added a comment -

        Thanks!

        Show
        Rodrigo B. de Oliveira added a comment - Thanks!

          People

          • Assignee:
            Doug H
            Reporter:
            Doug H
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: