On Fri, Feb 26, 2016 at 03:39:59AM GMT, Артур Истомин wrote:
> Suppose I have file with next lines among others:
>
> Omsa Attiva 40 cioccolato 2
> Omsa Attiva 40 blue XXL
> Omsa Attiva 40 milk S
> Omsa Attiva 40 sierra XXL
> Omsa Attiva 40 nero M
> Omsa Attiva 40 nero XXL
>
> I need to find lines, where size is XXL. I can do it with "Attiva\&.*XXL" in
> vim
> but it doesn't work in nvi. Are there any general way to do it in both
> editors?
>
> Thank you.
>
Hi Артур,
That's because Vim's "branch" ("\&") in a pattern is not part of POSIX
regular expressions (neither basic, nor extended).
man ex
REGULAR EXPRESSIONS
ex/vi supports regular expressions (REs), as documented in re_format(7),
for line addresses, as the first part of the ex substitute, global and v
commands, and in search patterns. Basic regular expressions (BREs) are
enabled by default; extended regular expressions (EREs) are used if the
extended option is enabled. The use of regular expressions can be
largely disabled using the magic option.
Drop it and you'll have a BRE :^)
Regards,
Raf
[0] http://vimdoc.sourceforge.net/htmldoc/pattern.html#pattern