Bug reports
- Author
- Message
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
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
\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
-
Offline
- Site Admin
- Posts: 6311
- Joined: Thu Jul 06, 2006 7:20 am
KDJ
It is so, if you press "Find next". Because: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.
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.
Already merged.In the new test version does not have changes that you have entered yesterday ...
Test versionI found still these bugs...
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
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}?
\a - matches the position at the beginning of the string.
\z - matches the position at the end of the string.
\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}?
Can you still add:Instructor wrote:\A Matches the position at the beginning of the search range.
\Z Matches the position at the end of the search range.
\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
Test versionKDJ wrote:The following two regular expressions work in different ways...
Don't understand the request. Can you explain with examples?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.
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
Instructor
I need to replace the first and last character in the text on "x".
Text:
What: \A.|.\Z
With: x
Result (Replace all):
It was to be:
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
I need to replace the first and last character in the text on "x".
Text:
Code: Select all
bbbb
bbbb
With: x
Result (Replace all):
Code: Select all
xxxxxxxxx
Code: Select all
xbbb
bbbx
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
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
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/
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
Code: Select all
123 abc abc abc abc
456 def def def
789 ghi ghi
Code: Select all
(\w+)\t(\w+)(\t\2)+
(*)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
KDJ
cnnncAkelHelp-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.
Test version(\w+)\t(\w+)(\t\2)+
-
Offline
- Posts: 119
- Joined: Sat Jan 12, 2008 10:16 am
- Location: Shantou, China
OK.Instructor wrote:cnnncTest version(\w+)\t(\w+)(\t\2)+
-
Offline
- Posts: 1949
- Joined: Sat Mar 06, 2010 7:40 pm
- Location: Poland
"Find" works well.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.
You need a bit to improve "Replace all".
Text (at the end is new line char):
Code: Select all
bbb
bbb
With: x
Result of Replace all:
Code: Select all
xbb
bbb
Code: Select all
xbb
bbbx
With: x
Result of Replace all:
Code: Select all
xbb
bbb
Code: Select all
xxxxxxxx