2010/12/27 ольга крыжановская <[email protected]>:
> 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!"

I like this. It is a *great* idea and would help to make complex regex
patterns more readable.

Chris
-- 
    ^---^
   (@)v(@)  Chris Pickett
   |    /   IT consultant
 ===m==m=== [email protected]

_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to