Author Topic: Beta 1 - command line replace doesn't escape properly  (Read 3516 times)

skywise

  • Senior Community Member
  • Posts: 331
  • Hero Points: 10
Beta 1 - command line replace doesn't escape properly
« on: September 05, 2014, 03:10:06 PM »
Also seen on 18.0.1.2

Was trying to replace some hex characters in a file with escaped C sequences.  I use brief keymode and the command line bar (at the bottom).  Search/replace is set to use unix regedit.

If I do search for \x00 and then replace with \\x00 (on the command line bar) then the replacement text will be "x00" (no slash)

I mucked around a bit thinking my regex-foo must be off or I had a bad setting somewhere but if I go to the actual replace dialog box and do the same thing, the replacement is correct.

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: Beta 1 - command line replace doesn't escape properly
« Reply #1 on: September 08, 2014, 12:40:50 PM »
I am not able to reproduce that from either the command-line or tool window.  What command are you invoking?

skywise

  • Senior Community Member
  • Posts: 331
  • Hero Points: 10
Re: Beta 1 - command line replace doesn't escape properly
« Reply #2 on: September 08, 2014, 03:05:28 PM »
I've got the following line of UTF8 text (Not sure if this will translate properly but it's UTF-8 string with, basically, extended ASCII)

    const std::string notAValidUTF8String("뼇-¹ÏƒÎ¼Îµ");

Using brief keymode with the command-line search/replace
I did - F6 (search)
\xB9
Replacement
\\xB9
What happens is SE finds the hex byte (good) but tries to replace it with "xB9" (ignoring the slash altogether)
I've seen this on 18.0.1.2 and 19 Beta 1.
Is it possible my regex for the command-line is setup differently than the one in the dialog box?  (I thought they were the same)


Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: Beta 1 - command line replace doesn't escape properly
« Reply #3 on: September 08, 2014, 03:06:36 PM »
Which platform was this on?

skywise

  • Senior Community Member
  • Posts: 331
  • Hero Points: 10
Re: Beta 1 - command line replace doesn't escape properly
« Reply #4 on: September 08, 2014, 03:14:22 PM »
Sorry, I'm usually better about that!  :D

Win7x64 - SP1

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: Beta 1 - command line replace doesn't escape properly
« Reply #5 on: September 08, 2014, 03:21:08 PM »
The file itself is just loaded with active codepage for encoding right?  It's not UTF-8 or anything like that?  I am also testing on Win7x64 and using Brief emulation with command-line prompting, there must be something in your config that I don't have set in my test.  Could you upload a copy of your vusrdefs.e from you configuration directory (v19 or v18 is fine).

skywise

  • Senior Community Member
  • Posts: 331
  • Hero Points: 10
Re: Beta 1 - command line replace doesn't escape properly
« Reply #6 on: September 08, 2014, 03:30:33 PM »
Yeah, I've tried this on both CPP, Text and HTML document modes and seeing the same on all 3.  I don't think I've changed the encoding type/defaults.  Here's my v18.0.1 defs

« Last Edit: September 08, 2014, 03:34:33 PM by skywise »

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: Beta 1 - command line replace doesn't escape properly
« Reply #7 on: September 08, 2014, 06:22:47 PM »
Thanks, that is what I needed to recreate it.  Your default option for Regular Expression is set to Wildcard not Unix in Options > Editing > Search.  It is working correctly for Unix, just not Wildcard.  I will see if I can put in a fix for one of the next drop.

skywise

  • Senior Community Member
  • Posts: 331
  • Hero Points: 10
Re: Beta 1 - command line replace doesn't escape properly
« Reply #8 on: September 08, 2014, 07:44:49 PM »
Thanks - I don't think I even knew that option was there!

skywise

  • Senior Community Member
  • Posts: 331
  • Hero Points: 10
Re: Beta 1 - command line replace doesn't escape properly
« Reply #9 on: September 12, 2014, 07:03:19 PM »
Fixed in beta 4 for wildcard search but there's a quirk if your search is setup for Unix expression (maybe others)

Tried a simple replace of "blah" with \x05 with an interactive replace.  When it found a match to replace the popup/flyover window (that shows what the replacement will be) it showed a "blank" field (probably because \x05 isn't printable).  I'm not sure if that's the behavior you want for that? (maybe show the whole regex expression?)  (The replacement worked fine however)