Re: Search with regex in nvi

2016-02-26 Thread Артур Истомин
Ok, thank you guys, I'am sometimes exclusively stupid :)



Re: Search with regex in nvi

2016-02-26 Thread Raf Czlonka
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



Re: Search with regex in nvi

2016-02-25 Thread Martijn van Duren
>From what I can see your regex is the same as Attiva.*XXL[1],
so why not just that one?

Or what pattern are you trying to match exactly?

On 02/26/16 04:39, Артур Истомин 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.
> 
[1] use both /Attiva\&.*XXL and /Attiva.*XXL in vim with :set hlsearch