Why is ^c to reference clipboard content not working in a Perl regular expression replace in a macro?

Why is ^c to reference clipboard content not working in a Perl regular expression replace in a macro?

6
NewbieNewbie
6

    Nov 15, 2022#1

    I use UEStudio v2022.1.0.112 with a macro. But I am facing a problem with a not working Perl regular expression referencing the clipboard content with ^c.

    Macro:

    Code: Select all

    InsertMode
    ColumnModeOff
    HexOff
    PerlReOn
    GotoLine 15 1
    PerlReOn
    Find RegExp ".+"
    Copy
    SelectToBottom
    PerlReOn
    Find RegExp SelectText "^(\d+-\d+)\r\n(.+)$"
    Replace All "$1\r\n^c@@$2"
    Key RIGHT ARROW
    Text:

    Code: Select all

    RIDI
    Recueil des Cours - Index général
    3
    000
    General Index to the <italic>Collected Courses</italic> of the Hague Academy of International Law
    000
    1980
    9789028606302
    Suthoff &amp; Noordhoff
    Alphen aan den Rijn - The Netherlands
    1980 Samsom-Sijthoff, Alphen aan den Rijn
    1980
    Samsom-Sijthoff, Alphen aan den Rijn
    292
    00000000
    author##D. Dhenki
    1-5
    Table par Tome des Cours

    6,687587
    Grand MasterGrand Master
    6,687587

      Nov 15, 2022#2

      The special characters ^c and ^s are supported only in non-regular expression and in UltraEdit regular expression finds/replaces whereby the clipboard content or the selected text is interpreted as UltraEdit regular expression string on using ^c and ^s in an UltraEdit regular expression find/replace. ^c and ^s are not available for Unix and Perl regular expression finds/replaces because of ^ as special meanings in Unix/Perl syntax.

      There could be used the following macro using the UltraEdit regular expression engine:

      Code: Select all

      InsertMode
      ColumnModeOff
      HexOff
      PerlReOn
      GotoLine 15 1
      UltraEditReOn
      Find MatchCase RegExp "?+"
      IfFound
      Clipboard 9
      Copy
      SelectToBottom
      Find MatchCase RegExp SelectText "%^([0-9]+-[0-9]++^p^)"
      Replace All "^1^c@@"
      Key RIGHT ARROW
      ClearClipboard
      Clipboard 0
      EndIf
      
      For the posted example text can be used also the following macro using a single Perl regular expression replace all executed from top of the file:

      Code: Select all

      InsertMode
      ColumnModeOff
      HexOff
      Top
      PerlReOn
      Find RegExp "^(\d+)(\r\nauthor.+\r\n\d+-\d+\r\n)"
      Replace All "$1$2$1@@"
      Best regards from an UC/UE/UES for Windows user from Austria

      6
      NewbieNewbie
      6

        Nov 15, 2022#3

        But the macro run 100% in UEStudio v19, just not in UEStudio v2022.

        6,687587
        Grand MasterGrand Master
        6,687587

          Nov 15, 2022#4

          You are right, ^c and ^s could be used also in Unix and Perl regular expression replace strings as I could find out now. I was not aware of that fact at all until now although using UltraEdit already since 20 years. I could verify that with UltraEdit v10.10c released February 2004 and some other versions up to UltraEdit for Windows v28.20.0.92 released November 2021. UEStudio supports from first released version up to version 21.10.0.32 also ^c and ^s in replace string of a Unix or Perl regular expression replace.

          No version of UltraEdit or UEStudio supported according to my tests ^c and ^s in search string of a Unix or Perl regular expression find/replace. In the Unix/Perl regular expression search string ^ is always interpreted as beginning of line and ^c and ^s results therefore in searching case-sensitive or case-insensitive depending on option Match case for the character c respectively s at beginning of a line.

          The special characters ^c and ^s can be used in non-regular expression and UltraEdit regular expression finds/replace in search and in replace string.

          The usage of ^c and ^s does not work anymore since UEStudio/UltraEdit for Windows v2022.0.0.70 up to currently latest v2022.1.0.112.

          There is not described detailed enough in help of UltraEdit/UEStudio where exactly ^c and ^s can be used in regular expression finds/replace with the three available regular expression engines. I found nowhere in file changes.txt in program files directory of UltraEdit, in changes_ues.txt in program files directory UEStudio, in all UE/UES hotfix information ever published public and archived by me and in all information sent to beta testers by email in the past and also archived by me an information about usage of ^c and ^s in Unix/Perl regular expression replace strings. So, I don't know if that is a promised feature of UE/UES or worked just by chance in all versions of UE/UES < 2022.0.0.70. Well, there were a few versions in my tests on which ^c and ^s worked only in replace string of a Unix regular expression replace, not in a Perl regular expression replace string.

          You have to contact UltraEdit support by email and ask for clarification regarding to the support of ^c and ^s in Unix/Perl regular expression strings. I don't know if the behavior of UE/UES v2022.0.0.70 to v2022.1.0.112 regarding to ^c and ^s in Unix/Perl regular expression replace string must be rated as bug as that should work or the change was done intentionally because of ^c and ^s in Unix/Perl regular expression replace strings worked just by chance and not by design in UE/UES prior v2022.0.0.70.
          Best regards from an UC/UE/UES for Windows user from Austria