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

22538Re: Pre-release #2 of NoteTab 7.0 available

Expand Messages
  • flo.gehrke
    Mar 29, 2012
    • 0 Attachment
      --- In ntb-clips@yahoogroups.com, "diodeom" <diomir@...> wrote:
      > Wow. I'm elated by the introduction of regex support in
      > ^$StrReplace()$. Thank you, Eric, for granting my primary wish!
      > I notice that absence of option A doesn't seem to prevent swapping
      > of all matches. For example, if the task were to replace only the
      > first occurence of repeated characters:
      > ^!Set %x%=foo bar baa
      > ^!Set %x%=^$StrReplace("(.)\1";"$1";"^%x%";R)$
      > ^!Prompt ^%x%
      > My output* is "fo bar ba" instead of anticipated "fo bar baa."

      It's the same issue with wildcards. For example, test...

      ^!Info ^$StrReplace("a*";"000";"aaa bbb ccc aaa bbb ccc";*)$

      Since '*' should match 0 or more WORD characters, I expect '000 bbb ccc aaa bbb ccc'. The clip, however, returns '000 bbb ccc 000 bbb ccc' which should happen only if 'A' was set.

      Also, the new ^$StrReplace$ doesn't seem to output any error messages in case it contains a RegEx syntax error. You may test it with...

      ^!Info ^$StrReplace("a\K+b";"c";"ab";R)$

      The clip returns 'ab' whereas it should return 'Regex error: nothing to repeat' since '\K' can't be repeated.

      Nevertheless, combining more string functions with RegEx is a great improvement! Bravo, Eric! It just needs some more fine-tuning...

      So far, it hasn't been made quite clear -- but I've got the impression that NT 7.0 also accepts the old syntax of ^$StrReplace$, isn't it?

    • Show all 5 messages in this topic