Page 10 of 13
Posted: Thu Mar 07, 2013 12:07 pm
by KDJ
Thanks Instructor.
Now, "\0" generates a syntax error, so it's OK.
Posted: Fri Mar 08, 2013 1:36 pm
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
Posted: Fri Mar 08, 2013 3:23 pm
by KDJ
I found still these bugs:
\Z - also matches "Z" character,
.\A - also matches any character plus "A" (eg: "BA", "CA").
Posted: Sat Mar 09, 2013 6:40 am
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
Posted: Sat Mar 09, 2013 1:44 pm
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".
Posted: Sun Mar 10, 2013 9:48 am
by Instructor
KDJ wrote:description of expression "(?<!pattern)" is truncated
Corrected.
Posted: Sun Mar 10, 2013 12:26 pm
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.
Posted: Fri Mar 15, 2013 8:29 am
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?
Posted: Fri Mar 15, 2013 8:00 pm
by KDJ
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
Posted: Sat Mar 16, 2013 10:09 am
by Instructor
KDJ wrote:What: \A.|.\Z
These expressions work in different ways...
Test version
Posted: Sat Mar 16, 2013 1:25 pm
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/
Posted: Mon Mar 18, 2013 2:43 am
by cnnnc
Code: Select all
123 abc abc abc abc
456 def def def
789 ghi ghi
Ctrl+F
[v]Regular Expression
(*)Beginning
It's can't find any. But SearchReplace.js can.
I have to try
--------------------
WinXP SP3 ChineseSimplified With most safe hotfix
AkelPad 4.8.1+
Posted: Thu Mar 21, 2013 5:47 am
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
Posted: Thu Mar 21, 2013 7:30 am
by cnnnc
Posted: Thu Mar 21, 2013 8:32 pm
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):
What: \A.|.\Z
With: x
Result of Replace all:
It should be:
What: \a.|.\z
With: x
Result of Replace all:
It should be: