Help for search()
states that
'ignorecase', 'smartcase' and 'magic' are used.
However, if I run the following:
printf "aaa\nAAA\nbbb\nBBB\n" | \
vim \
-u NONE \
+'set nocompatible ignorecase smartcase' \
+"nnoremap S :echo search('\<aaa\>\\\|\<BBB\>', 'w')<CR>" \
-
...and then press S
, only aaa
and BBB
entries will be found, while I'd expect also to find AAA
.
Am I wrong?
(Sure, I can include \c
atom in the search pattern but that will also match bbb
.)
Vim version: 9.1.381
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Well, smartcase
means, if you have a pattern with at least one upper case character, the search becomes case sensitive. And that's what's happening here.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Oh, the whole pattern, not just that uppercased part... I see, thanks, Christian!
(On a side note, and if I want to match here aaa
, AAA
and BBB
, I simply have list everything in the pattern, there's no some other smart way? )
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Closed #14831 as completed.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Not sure what you want to match. You could use ^\w\{3\}$
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.
Perl's regex can turn on/off ignore case only a part of the pattern: (?i:aaa)|BBB
.
However, Vim doesn't support such pattern.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.