Author Topic: Perl Search & Replace error  (Read 1583 times)

jporkkahtc

  • Senior Community Member
  • Posts: 1901
  • Hero Points: 184
  • Text
Perl Search & Replace error
« on: July 29, 2016, 12:27:06 am »
Open asciitab and save to a writable location. Encoding: Binary
#1: This file only works if your font is "terminal". It should be updated to use "|" instead of character 0xb3.

Also S&R to eliminate the numbers and leave just the characters doesn't quite work
'\o:h  *\o:h *(.) *³' -> '"$1", '    replace_buffer_text("\\o:h  *\\o:h *(.) *\xC2\xB3","LIP*",'"$1", ','0','0','0', '0','0','0');

#2: First, for character 0, the red-box showing the results of the replace shows just a single ".
After doing the replace the buffer looks like " "

#3: Replacing the character 10 (\n) splits the line.
    10  A  *  |26  1A *  |42  2A *  |58  3A *  |74  4A *  |90  5A *  |
    11  B  *  |27  1B *  |43  2B *  |59  3B *  |75  4B *  |91  5B *  |
    12  C  *  |28  1C *  |44  2C *  |60  3C *  |76  4C *  |92  5C *  |

ends up as
    "*", "", |"*", "", |"*", "", |"*", "", |"*", "", |"*", "", |"",
    "
    ", "", |"*", "", |"*", "", |"*", "", |"*", "", |"*", "", |"",
    "*", "", |"*", "", |"*", "", |"*", "", |"*", "", |"*", "", |"",



#4: Lines too long???
Starting from asciitab, I replaced the char 0xb3 with |
Then I did another S&R:
    '\o:h  *\o:h *(.) *|'  -> '"$1", '
(Yes, I realize now my mistake of putting the | character in the find expression).

Then, I got two error dialogs from slick.
Remember, the entire size of this file is 5847 bytes.

    ---------------------------
    SlickEdit Pro
    ---------------------------
    AutoSave has failed to save the file C:\temp\asciitab.  Do you wish to disable AutoSave?
    ---------------------------
    Cancel   &Yes   &No   
    ---------------------------

    ---------------------------
    SlickEdit Pro
    ---------------------------
    The following line(s) are longer than the allowed limit: 18, 19, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53
    ---------------------------
    OK   
    ---------------------------


If I attempt to save, I get this:

    ---------------------------
    SlickEdit Pro
    ---------------------------
    Unable to save C:\temp\asciitab
    The following line(s) are longer than the allowed limit: 18, 19, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53
    ---------------------------
    OK   
    ---------------------------


I can do a save-as though.



Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5146
  • Hero Points: 425
Re: Perl Search & Replace error
« Reply #1 on: July 29, 2016, 01:11:06 am »
The ascii table is loaded as a record file width=66. Save as doesn't change that. Best to copy the file an open it.