Bug reports

English main discussion
  • Author
  • Message
KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

Thanks Instructor.
Now, "\0" generates a syntax error, so it's OK.

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

Instructor
\Z
- it seems to me that it works well.

There is a problem with \A anchor:
\A
- matches to the border between any characters and to the end of the text:
\A.
- matches any single character.

In the new test version does not have changes that you have entered yesterday ("\0", "\0+", "\0*", "\0{2,}"): viewtopic.php?p=21420&hilit=#p21420

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

I found still these bugs:
\Z - also matches "Z" character,
.\A - also matches any character plus "A" (eg: "BA", "CA").

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

KDJ
KDJ wrote: There is a problem with \A anchor:
\A
- matches to the border between any characters and to the end of the text:
\A.
- matches any single character.
It is so, if you press "Find next". Because:
AkelHelp-Eng.htm wrote:\A Matches the position at the beginning of the search range.
\Z Matches the position at the end of the search range.
In the new test version does not have changes that you have entered yesterday ...
Already merged.
I found still these bugs...
Test version

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

Instructor
Thank you very much, now everything is OK.

In AkelHelp-Eng.htm:
- description of expression "(?<!pattern)" is truncated,
- You can add that "\z" is equivalent "\Z".

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

KDJ wrote:description of expression "(?<!pattern)" is truncated
Corrected.

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

The following two regular expressions work in different ways:
\w+(\W*)
\w+\W*
In the first regexp, the "+" quantifier is lazy (non-greedy).
In the second, the "+" quantifier is greedy.

However, you may need to implement two types of quantifiers:
- greedy: ?, *, +, {n1,n2}
- lazy: ??, *?, +?, {n1,n2}?

Instructor wrote:\A Matches the position at the beginning of the search range.
\Z Matches the position at the end of the search range.
Can you still add:
\a - matches the position at the beginning of the string.
\z - matches the position at the end of the string.

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

KDJ wrote:The following two regular expressions work in different ways...
Test version
KDJ wrote:Can you still add:
\a - matches the position at the beginning of the string.
\z - matches the position at the end of the string.
Don't understand the request. Can you explain with examples?

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

Instructor
I need to replace the first and last character in the text on "x".
Text:

Code: Select all

bbbb
bbbb
What: \A.|.\Z
With: x

Result (Replace all):

Code: Select all

xxxxxxxxx
It was to be:

Code: Select all

xbbb
bbbx
Such anchors are needed to indicate the beginning and end of the text, no the beginning/end of the search range.

And one more thing. These expressions work in different ways:
(\Ab)|(b\Z)
\Ab|b\Z

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

KDJ wrote:What: \A.|.\Z
These expressions work in different ways...
Test version

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

Instructor
If:
\A - matches the position at the beginning of the search range,
\Z - matches the position at the end of the search range,
in the previous test version it worked well.

In the new test version it is inconsistent.
In the above example, regexp matches 9 times (8 times "b" and 1 time new line), and replaces only 2 times.

I propose to add two new anchors \a, \z (or change the way of working \A, \Z), so that:
\a - matches the position at the start of the text,
\z - matches the position at the end of the text.
"\a" should match only the beginning of the text (only once), like "^" matches only the beginning of the line (only once, if there is one line).

It seems to me that this is a well done in SynWrite: http://www.uvviewsoft.com/synwrite/

Offline
Posts: 119
Joined: Sat Jan 12, 2008 10:16 am
Location: Shantou, China

Post by cnnnc »

Code: Select all

123	abc	abc	abc	abc
456	def	def	def
789	ghi	ghi
Ctrl+F

Code: Select all

(\w+)\t(\w+)(\t\2)+
[v]Regular Expression
(*)Beginning
It's can't find any. But SearchReplace.js can.
I have to try

Code: Select all

(\w+)\t(\w\w\w)(\t\2)+
--------------------
WinXP SP3 ChineseSimplified With most safe hotfix
AkelPad 4.8.1+

Offline
Site Admin
Posts: 6311
Joined: Thu Jul 06, 2006 7:20 am

Post by Instructor »

KDJ
AkelHelp-Eng.htm wrote:\A Matches the position at the beginning of the document...
\Z Matches the position at the end of the document...
\a Same as \A, but matches the position at the beginning of the search range.
\z Same as \Z, but matches the position at the end of the search range.
cnnnc
(\w+)\t(\w+)(\t\2)+
Test version

Offline
Posts: 119
Joined: Sat Jan 12, 2008 10:16 am
Location: Shantou, China

Post by cnnnc »

Instructor wrote:cnnnc
(\w+)\t(\w+)(\t\2)+
Test version
OK.

KDJ
Offline
Posts: 1949
Joined: Sat Mar 06, 2010 7:40 pm
Location: Poland

Post by KDJ »

Instructor wrote:\A Matches the position at the beginning of the document...
\Z Matches the position at the end of the document...
\a Same as \A, but matches the position at the beginning of the search range.
\z Same as \Z, but matches the position at the end of the search range.
"Find" works well.
You need a bit to improve "Replace all".

Text (at the end is new line char):

Code: Select all

bbb
bbb
What: \A.|.\Z
With: x

Result of Replace all:

Code: Select all

xbb
bbb
It should be:

Code: Select all

xbb
bbbx
What: \a.|.\z
With: x

Result of Replace all:

Code: Select all

xbb
bbb
It should be:

Code: Select all

xxxxxxxx
Post Reply