No announcement yet.

Regular Expressions Back References help wrong?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Regular Expressions Back References help wrong?

    In the Help for Regular Expressions, it states
    Metacharacters - Back References

    Each sequence of characters which is matched within a "()" will be saved as a subexpression, which you can refer to later with \1 to \9, which refer to the subexpressions from left to right. b(.)\1n will match "been" and "boon", but not "bean", "ben" or "beeen".
    Also, in the "Sample Regular Expressions" section:
    \1 Back reference to 1st subexpression
    From the forums, it seems that the correct syntax is to use $1, not \1.

    It's never easy to setup a complicated Regular Expression, but if the help file tells you the wrong syntax then it's going to be impossible.
    So, could you update the help files for Regular Expressions please?

    BC v3.1.11

  • #2

    The back reference uses the \1 when it points to a location within the same regular expression (the same line).

    A tagged expression is when we use the $1. This occurs when it is actually a second regular expression (not the same line).

    It's a subtle difference. I hope that helps clear things up.
    If you are still having trouble, could you go into more detail on the specifics of your setup?

    Which dialog were you using RegEx in? What was the specific Reg Ex you were trying to setup?
    Aaron P Scooter Software


    • #3
      Hi Aaron,

      I was trying to set up some alignment overrides in the session settings.
      I got there in the end, after reading some forum posts, and now I understand the syntax better.
      It's just that the syntax was not that clear from the help alone.