EmEditor (text editor) Forum Index
   Regular Expressions
     Exceptions or bugs?
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
LTT
Posted on: 7/8/2011 9:41 am
Just can't stay away
Joined: 10/11/2006
From:
Posts: 84
Exceptions or bugs?
1.
I want to replace "\{[\s\S]+?\}" with "".
"\{[\s\S]+?\}" can match multi-line text even when "Regular Expressions Can Match New Line Characters" option is off, if I use Replace Next.
But when using Replace All, that option has to be enabled.
Is this by design?



2.
For example, if I want to replace something with "\x{2030}\n", the Replace with text has to be "\x{2030}\\n" or "\x2030\\\n".



3.
Escape sequences are always on when searching from the command line.
But when I want to search a single "\" from the command line, I have to use "\\\\", not "\\".
Yutaka
Posted on: 7/8/2011 10:23 am
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2422
Re: Exceptions or bugs?
Hello,

Are you using the normal Find/Replace? Or Find in Files/Replace in Files?

Thanks!


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

LTT
Posted on: 7/8/2011 10:44 am
Just can't stay away
Joined: 10/11/2006
From:
Posts: 84
Re: Exceptions or bugs?
Sorry.

1 and 2 are the normal Find/Replace.
3 is Find in Files.
Yutaka
Posted on: 7/8/2011 11:05 am
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2422
Re: Exceptions or bugs?
1. It is possible that the Replace All do not work exactly same as the Replace Next.

2. Can you please create a sample file, and explain what you expect as a result? You might want to zip your sample file, and send it to tech@emurasoft.com, and please identify yourself as a forum member.

3. It is possible that you might escape a backslash when you use a command line, and escape again when using escape sequences.

Thanks!


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

LTT
Posted on: 7/9/2011 4:02 am
Just can't stay away
Joined: 10/11/2006
From:
Posts: 84
Re: Exceptions or bugs?
Quote:
Yutaka wrote:
2. Can you please create a sample file, and explain what you expect as a result? You might want to zip your sample file, and send it to tech@emurasoft.com, and please identify yourself as a forum member.


For example, the original text:
1-2-3-4-5-


My goal:
1‰
2‰
3‰
4‰
5‰


If I replace "-" with "\x{2030}\n" (which I think is a correct regular expression), the result is:
1‰n2‰n3‰n4‰n5‰n


If I use "\x2030\n", the result is:
1‰2‰3‰4‰5‰


I achieved my goal by using "\x{2030}\\n" or "\x2030\\\n".
But how to understand the excessive backslash(es)?
Yutaka
Posted on: 7/9/2011 12:15 pm
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2422
Re: Exceptions or bugs?
Hello LTT,

Thank you for explaining. This was certainly a bug, and I am fixing it for the next minor version - 10.1.0.

Thanks again!


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

LTT
Posted on: 7/10/2011 9:47 am
Just can't stay away
Joined: 10/11/2006
From:
Posts: 84
Re: Exceptions or bugs?
Quote:
Yutaka wrote:
3. It is possible that you might escape a backslash when you use a command line, and escape again when using escape sequences.

I don't get it yet on issue 3. Could you explain a little further please?

It seems this only happens when the FindWhat string is ended with a backslash. Examples:
* To find "\" (1 backslash), I have to use "\\\\" as the FindWhat string in the command line.
* To find "\\" (2 backslashes), I have to use "\\\\\\\\".
* To find "a\" (an "a" and a backslash), I have to use "a\\\\".

But to find "\a" (a backslash and an "a"), only "\\a" is needed. Only this one is in line with my expectations.
Yutaka
Posted on: 7/10/2011 10:41 am
Webmaster
Joined: 9/28/2006
From: Redmond
Posts: 2422
Re: Exceptions or bugs?
Hi LTT,

This is a Windows issue, and not the EmEditor issue. Windows escape and unescape command lines because a double quote (") and a backslash (\) has a special meaning. For instance, \" means " so you will need to use \\" to send a backslash and a quote. It is a very complicate matter, so please refer to Microsoft documents in order to understand how to escape command lines. While the command options are documented in the EmEditor Help, this Find in Files command option is not recommended to use directly. It is internally used by EmEditor.


----------------
Yutaka Emura
Developer of EmEditor
http://www.emeditor.com/

Threaded | Newest First Previous Topic | Next Topic | Top


Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文