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

17144Re: Regular expression replace upon a string variable - howto?

Expand Messages
  • Flo
    Nov 27, 2007

      No, ^$StrReplace doesn't accept a regex. I think, in some cases,
      inserting another condition could serve as a work-around.

      Example: A variable %Var% could contain a year between 2000 and 2009.
      In order to replace only years from 2000 to 2006 with 2007 we could

      ^!Set %Var%=2001
      ^!IfMatch "\d{3}[0-6]" "^%Var%" Next Else Skip
      ^!Set %Var%=^$StrReplace(^%Var%;2007;^%Var%;0;1)$
      ^!Info ^%Var%

      This wouldn't replace the year 2008, for example. Of course, a limited
      solution only...

    • Show all 7 messages in this topic