Loading ...
Sorry, an error occurred while loading the content.

19727Asterisk in Negative Character Class

Expand Messages
  • flo.gehrke
    Oct 1 10:31 AM
    • 0 Attachment
      In a text database, some terms are marked with asterisks for indexing. For example...

      Alexander von **Humboldt**'s travel diary of his journey on the **Orinoco** in April **1800** reminds us of the complex and difficult stages of his writing process.

      When running...

      ^!Info ^$GetDocListAll("[*\d]{2,}";"$0\r\n")$

      against this string the clip correctly outputs:


      The RegEx used here complies with PCRE rules: Inside a Character Class, an asterisk is no metacharacter but a literal asterisk.

      Next, I tried to output those terms without the asterisks running...

      ^!Info ^$GetDocListAll("(?:\*\*)([^*]+)\*\*";"$1\r\n")$

      In this case, the output is quite absurd. An error message pops up saying "Regex error: PCRE does not support \L, \l, \N, \U, or \u" -- although none of these metacharacters is used here.

      After OK, the Infobox appears displaying the same error message again.

      Obviously, the clip misinterprets the Negative Character Class [^*]. Though PCRE doesn't demand it here, it works if we escape the asterisk with [^\*].

      Strange -- isn't it?

    • Show all 3 messages in this topic