Regex for end-of-file anchor
-
There is indeed an issue,
\'
matches the end buffer and the other the start of buffer -
@PeterJones - issue and pr opened.
@M-Andre-Z-Eckenrode - thank you for reporting the issue. -
Hello, @m-andre-z-eckenrode, @ekopalypse, @peterjones and All ,
The manual states :
-
\A
or\'
=> The start of the matching string. -
\z
or\`
=> The end of the matching string. -
\Z
Matches like\z
with an optional sequence of newlines before it. This is equivalent to(?=\v*\z)
, which departs from the traditional Perl meaning for this escape.
Well, there is some typos here !
Indeed, the correct text should be :
-
\A
or\`
or(?-m)^
=> The start of the matching string. -
\z
or\'
or(?-m)$
=> The end of the matching string. -
\Z
Matches like\z
with an optional sequence of vertical blank characters before it. This is equivalent to the assertion
(?=[\n\f\r\x85\x{2028}\x{2029}]*\z)
, which departs from the traditional Perl meaning for this escape.
So, @ekopalypse, there is absolutely no regex issue at all !!
Notes :
-
For a correct behavior of the
\A
assertion, whatever its syntax, you must use, at least, Notepad++v7.9.1
-
The
\Z
assertion is not stricly equivalent to(?=\v*\z)
as the\v
character class is identical to the[\n\x0B\f\r\x85\x{2028}\x{2029}]
character class
Best Regards,
guy038
-
-
?? - but you yourself state that the documentation is wrong ??
What am I missing?? -
Hi, @m-andre-z-eckenrode, @ekopalypse, @peterjones and All,
Sorry, @ekopalypse. I misspoke :
Of course, an issue should be created to modify this part of the N++ official documentation !
But, from a functional and regex point of view, the assertions
\`
,\'
work properly and are identical, respectively, to the\A
and\z
assertions !BR
guy038
-
@guy038 - ok and I’ve created the issue and the pull request already. Just needs to be merged.
-
@guy038 said in Regex for end-of-file anchor:
The manual states :
\A or ’ => The start of the matching string.
\z or ` => The end of the matching string.
If the manual is being improved, how about really improving it?
“The start of the matching string” and “The end of the matching string” are not very good phrases for the Notepad++ user/manual.
I guess they work fine in the context of a programmer calling the Boost C++ function (where these phrases originated from, I think).
But why aren’t they referred to in the Notepad++ user manual as relating to start-of-file and end-of-file, respectively?
-
@Alan-Kilborn said in Regex for end-of-file anchor:
But why aren’t they referred to in the Notepad++ user manual as relating to start-of-file and end-of-file, respectively?
Makes sense to me. @Ekopalypse , when you get a chance, could you update your PR?
-
Thanks for PR#197. It has been merged, and will be in the next release.
For now, you can see the updated docs in searching.md. The fixes will be in the live document the next time there’s a website release (probably after NPP v7.9.6 is released).
-
@PeterJones and everyone else —
Looks good, thanks!