No announcement yet.

Lookaround in regex

  • Filter
  • Time
  • Show
Clear All
new posts

  • Lookaround in regex

    I would like to have lookbehind/lookahead in the regex used in grammars, since there are a lot of things that just impossible to do without it.

  • #2
    Thanks. Enhancing this support is on our Customer Wishlist. If you have any examples you would like to post, we can add those to our entry on this subject.
    Aaron P Scooter Software


    • #3
      For example, I have a file that looks like this:
      name("strings","and","numbers",1234) = "data"

      Without compromising the string/numeric/punctuation formatting in the middle, I would like to have the last subscript to be unimportant if the name at the beginning is a specific value. I would also like the data to be unimportant if the last subscript has a specific value.

      Currently I can make a regex that does this, but it cannibalizes the rest of the syntax highlighting since I have to consume all of the text that enabled the condition.


      • #4
        I would also like to add my voice to this request.

        I want to use a simple regex such as [a-zA-Z]+(?=\([^)]*\)) to set up a grammar rule for method/function names, without consuming the content within the parenthesis. Since lookahead is apparently not supported, I am forced to consume the arguments with my Method grammar rule, which is not preferable.

        Any suggestions for alternate regex would be appreciated.