[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ast-users
Subject:    Re: [ast-users] Word boundaries \< and \> supported in ksh ~(E)?
From:       Glenn Fowler <gsf () research ! att ! com>
Date:       2010-11-11 17:05:42
Message-ID: 201011111705.oABH5gBv029113 () penguin ! research ! att ! com
[Download RAW message or body]


finally getting around to this ...

first in ~(Elr)
	'l' turns on left anchor, i.e., the expression is treated as if
	    it starts with ^
	'r' turns on right anchor, i.e., the expression is treated as if
	    ends with $
I'm not sure this was intended
left and right anchor are turned off by ~(E)

second, one problem is the (.+) inside \<...\> consumes all chars,
including word boundary chars (e.g., space in the example)

but the big problem is that the \< and \> are not properly escaped
by the shell when passed down to the regex library
once this is fixed we can revisit the example

On Sun, 31 Oct 2010 18:19:42 +0100 =?KOI8-R?B?z8zYx8Egy9LZ1sHOz9fTy8HR?= wrote:
> Does ksh ~(E) support word boundaries \< and \>? I have tried lengthy
> to get it working but I only receive failures.

> As example I tried this expression to match three words with the \<
> and \> word boundaries but instead \1 captures the whole string:
> x="hello 12 world" ; y="${x/~(Elr)\<(.+)\>\<(.+)\>\<(.+)\>/\1}" ;
> printf "%s\n" "$y"
> hello 12 world

> I need an example which works, and if ~(P) supports word boundaries I
> need an example here, too.

> Olga
> -- 
>       ,   _                                    _   ,
>      { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
> .----'-/`-/     olga.kryzhanovska@gmail.com   \-`\-'----.
>  `'-..-| /       http://twitter.com/fleyta     \ |-..-'`
>       /\/\     Solaris/BSD//C/C++ programmer   /\/\
>       `--`                                      `--`
> _______________________________________________
> ast-users mailing list
> ast-users@research.att.com
> https://mailman.research.att.com/mailman/listinfo/ast-users

_______________________________________________
ast-users mailing list
ast-users@research.att.com
https://mailman.research.att.com/mailman/listinfo/ast-users
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic