Glenn, thank you very much.

The extra ( ) pair does not pose much of a problem because users can
use (?: ) to make the bracket pair non capturing, i.e. bracket pairs
with ?: will not collect data for .sh.match

Olga

On Mon, Jan 3, 2011 at 11:28 PM, Glenn Fowler <[email protected]> wrote:
>
> this was done before you asked
>
> ast regex(3) has REG_COMMENT which is controlled by the 'x' runtime flag
> (as opposed to the suggested 'f') for perl support
>
> to get around the ]] parsing problem (and to get the shell to parse it in the 
> first place)
> simply (...) the entire expression after the flags:
>
> [[ "aaa bbb 123 ccc" == ~(Ex)(
>          (...)                 # aaa
>          [[:blank:]]+
>          [[:alnum:]]+          # bbb
>          [[:blank:]]+
>          ([[:digit:]]+)        # 123
>          [[:blank:]]+
>          ) ]] && printf "match!\n"
>
> On Mon, 27 Dec 2010 16:28:12 +0100 =?KOI8-R?B?z8zYx8Egy9LZ1sHOz9fTy8HR?= 
> wrote:
>> I'd like to request a "free-spacing and comments" regex mode in ksh so
>> that regular expressions, i.e. ~(G), ~(E), ~(X), ~(P), can span
>> multiple lines like in perl, JAVA or VB.NET. "Free-spacing and
>> comments" in this context means that white spaces are ignored for
>> pattern patching and any thing between a "#" character and the end of
>> the line is treated as comment, i.e. are "removed" at regex compile
>> time, and white spaces and "#" can only be used for matching if
>> explicitly addressed with [[:space:]], [[:blank:]] or octal
>> addressing.
>
>> Below is an example for the proposed functionality, using modifier "f"
>> to enable the free-spacing and comments mode:
>
>> [[ "aaa bbb 123 ccc" == ~(Ef)
>>           (...)
>>           [[:blank:]]+
>>           [[:alnum:]]+
>>           [[:blank:]]+
>>           ([[:digit:]]+)
>>           [[:blank:]]+
>>           ]] && printf "match!\n"
>
>> This example should print "match!"
>
>> Olga
>> --
>>       ,   _                                    _   ,
>>      { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
>> .----'-/`-/     [email protected]   \-`\-'----.
>>  `'-..-| /       http://twitter.com/fleyta     \ |-..-'`
>>       /\/\     Solaris/BSD//C/C++ programmer   /\/\
>>       `--`                                      `--`
>> _______________________________________________
>> ast-developers mailing list
>> [email protected]
>> https://mailman.research.att.com/mailman/listinfo/ast-developers
>
>



-- 
      ,   _                                    _   ,
     { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
.----'-/`-/     [email protected]   \-`\-'----.
 `'-..-| /       http://twitter.com/fleyta     \ |-..-'`
      /\/\     Solaris/BSD//C/C++ programmer   /\/\
      `--`                                      `--`
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to