Existing script not working after update to version 2022.1.0.100 (solved)

Existing script not working after update to version 2022.1.0.100 (solved)

27
Basic UserBasic User
27

    Sep 13, 2022#1

    I have a script that @Mofi helped me with two years ago that until recently has worked like a champ. It takes a file and parses it out into many files by reading through the file, locating starting and end lines and saving the contents to a new file and then moving through the file to find the next start & end lines and it repeats this until every set of start/end section has been saved to its own file. After the last update it has changed. Let's assume I have ten sets of sections (ten start & end lines) in the file. In the past after running the script I would end up with ten new files, each contains one section and the original file is also there unmodified. What is happening now when I run it is that just two new files are created. One file contains the section of code and the other file is a copy of the master minus the first section of code. I do hope this properly explains the issue.

    I have made NO changes at all to the script. So I can only speculate that something has changed with UE with scripts. 

    Thoughts?

    Mofi
    6,48846632
    Grand MasterGrand Master
    6,48846632

      Sep 14, 2022#2

      There is of course no intentional change made by the UltraEdit/UEStudio developers which would cause macros and scripts not working anymore as with previous versions. So there can be only a bug causing the different execution behavior. It would be necessary to have the script and a sample file with, for example, three sections on which the script now with currently latest version 2022.1.0.100 creates not anymore three files as in previous versions.
      Best regards from an UC/UE/UES for Windows user from Austria

      YSLGuru
      27
      Basic UserBasic User
      27

        Sep 14, 2022#3

        Mofi, I have attached both the JavaScript file and a copy of the CSV file I use it on. NOTE: The last modified date on the JavaScript file is from 2018, when you last edited it for me. So I don't know how the script could have changed. Thanks for taking the time to look into this.
        parse_yardi_script_and_csv_files.zip (519.7 KiB)   2
        Zip file with the UltraEdit script file and an example CSV file.

        Mofi
        6,48846632
        Grand MasterGrand Master
        6,48846632

          Oct 16, 2022#4

          The problem of not working script is caused by a bug in UltraEdit for Windows v2022.1.0.90 to currently latest v2022.1.0.112. Former versions of UltraEdit for Windows do not have this issue. I reported this issue to UltraEdit support by email and got the reply that the issue could be reproduced and is forwarded to the developers for investigation and correction.

          The issue is that the Perl regular expression find with the search expression ^(?:[^\r\n,]*,){2}[\t ]*\K3040    , returns a positive match for 3040 in line 2 and in line 261, but not for all further lines below like line 527 or line 798, except the caret is moved after finding the string in line 261 to at least line 485 as I could find out with doing this find manually. That is obviously a file block loading issue while running a Perl regular expression find.

          I could find out further that the file block loading issue during execution of a regular expression find does not occur on using the legacy UltraEdit regular expression engine to find the next occurrence of 3040 in third data column of the CSV file.

          The script in the attached ZIP file uses for that reason the UltraEdit regular expression engine for the regular expression finds which could be done with just modifying three lines in the script. Version 2 of the script using the UltraEdit regular expression engine produces now with UltraEdit v2022.1.0.112 the same files for the example CSV file as the original script with UltraEdit for Windows up to v2022.0.0.102 as verified by me.

          Update: I detected further on writing the issue report with the detailed steps to reproduce that the Perl regular expression finds work fine on removing \K from the search expression. That means the first version of the script works also fine on the example CSV file on removing in line 44 the three characters \\K from the search expression string which is used to find the beginning of the next block in the CSV file. \\K in line 42 to find the first field value in third CSV data column in second row (first data row) can be kept because of that initial find works always at top of the file.
          parse_yardi_script_v2.zip (1.57 KiB)   2
          Version 2 of the script using UltraEdit regular expression engine
          Best regards from an UC/UE/UES for Windows user from Austria

          YSLGuru
          27
          Basic UserBasic User
          27

            Oct 17, 2022#5

            @Mofi - Wow just wow. I'm not going to lie, I'm not versed in Perl (although I do understand regular expressions at a very elementary level) but I am a T-SQL developer so I can appreciate the kind of trouble shooting/debugging you had to do to track this down. On the upside we found a bug to make UltraEdit support aware of.

            Thank you very much!

            Mofi
            6,48846632
            Grand MasterGrand Master
            6,48846632

              17:51 - 9 days ago#6

              The Perl regular expression find issue causing the first version of the script not working correct with UE/UES v2022.1.0.90 to v2022.1.0.124 is fixed with UE/UES v2022.2.0.34. Both script versions produce the same files on using UE/UES v2022.2.0.34 as well as on using UE/UES v2022.0.0.102.
              Best regards from an UC/UE/UES for Windows user from Austria