EmEditor (text editor) Forum Index
   EmEditor Core Bug Reports
     Only single match is highlighted when regex contains \n...
Register To Post

Threaded | Oldest First Previous Topic | Next Topic | Bottom
Poster Thread
CrashNBurn
Posted on: 7/13/2011 7:13 pm
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Re: Only single match is highlighted when regex contains \n...
I do it so I can see at a glance that there is in fact a space being matched.

Regex strings are hard enough to look at as it is
Functionally it is likely no different, but visually, and for working with them, much easier for me to figure out:
[ ]+ than
+
Deipotent
Posted on: 7/13/2011 6:46 pm
Just can't stay away
Joined: 2/15/2008
From:
Posts: 118
Re: Only single match is highlighted when regex contains \n...
In your last two regex's you place the space in square brackets (ie. "[ ]" instead of " "). Why is this ?

Is that considered a better/clearer way of writing it ?

CrashNBurn
Posted on: 7/13/2011 6:38 pm
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Re: Only single match is highlighted when regex contains \n...
My Test file:
teststring
teststring
teststring
teststring



ABCDE: .abc3;.s32
ABCDE: .abc3;.s32
ABCDE: .abc3;.s32
ABCDE: .abc3;.s32

This regex, Quote:
: +([[:alnum:];\.]+)\n
Matches the first 3 ABCDE lines.
This regex, Quote:
: +([[:alnum:];\.]+)$
Matches all 4.
And with this file:
teststring
teststring
teststring
teststring



ABCDE: .abc3;.s32
ABCDE:  .abc3;.s32
ABCDE:   .abc3;.s32
ABCDE:    .abc3;.s32

This regex: Quote:
:[ ]+([[:alnum:];\.])+$
Matches all 4 ABCDE's.

And with this file:
teststring
teststring
teststring
teststring



ABCDE: .abc3;.s32
ABCDE:  .abc3;.s32
ABCDE:   .abc3;.s32
ABCDE:    .abc3;.s32


This regex: Quote:
:[ ]+([[:alnum:];\.])+\n
Matches all 4 ABCDE's.
Deipotent
Posted on: 7/13/2011 6:03 pm
Just can't stay away
Joined: 2/15/2008
From:
Posts: 118
Re: Only single match is highlighted when regex contains \n...
You are correct that the first period is not necessary, that the period in the character set should be escaped, and that the second * should be a +. My regex is a little rusty.

The first * should also be a +, as I want it to match one or more spaces, so the regex should probably be

: +([[:alnum:];\.]+)\n


The issue I reported with only a single match being highlighted is still present, even with the updated regex.
CrashNBurn
Posted on: 7/13/2011 5:46 pm
Just can't stay away
Joined: 4/8/2010
From:
Posts: 130
Re: Only single match is highlighted when regex contains \n...
I'm confused as to what you are searching for.
Especially since you are using multiple instances of "*"
--- Which with regex are rarely necessary, and frequently will mangle your search results.

[[:alnum:];.] ---> means match *ANYTHING*

You haven't escaped the period. and it will match any char.
Possibly you meant:
[[:alnum:];\.]

But then, this: ([[:alnum:];\.])*
Means match any alphanumeric plus semi-colon plus a dot any number of times, or not at all. Meaning it will also match empty lines - that only have a carriage return.

Possibly, what you meant as your regex:
Quote:
: ([[:alnum:];\.])+\n
Deipotent
Posted on: 7/13/2011 4:11 pm
Just can't stay away
Joined: 2/15/2008
From:
Posts: 118
Only single match is highlighted when regex contains \n...
If you have lines of the following format "ABCDE: .abc3;.s32", and have incremental search enabled, all matching lines are highlighted with a regex of ": . *(\.([[:alnum:];.])*)", but only a single match is highlighted with ": . *(\.([[:alnum:];.])*)\n"
Threaded | Oldest First Previous Topic | Next Topic | Top


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