Interesting little regex
Josh Coates
jcoates at archive.org
Thu Feb 23 11:30:34 MST 2006
> very simplified, but the basic point is there. Make things
> readable, comment, etc....
there you go again jayce, helping to make perl an actual useful language for
software engineering instead of a language for obfuscated code tricks...
;-)
-josh
> -----Original Message-----
> From: plug-bounces at plug.org [mailto:plug-bounces at plug.org] On
> Behalf Of Jayce^
> Sent: Thursday, February 23, 2006 11:19 AM
> To: Provo Linux Users Group Mailing List
> Subject: Re: Interesting little regex
>
> Charles Curley wrote:
> >> You've got the x flag, please use it!
> >
> > You mean this regex is x rated?
>
> hehe...
> actually though, for any who don't know:
> In perl regex, there are flags at the end (to be fixed, perl6
> has them rightly in the front) that modify your engine. One
> of these is the underutilized x modifier. When added, it
> makes whitespace insignificant in your regex, so you can
> nicely tab/space/newline in order to actually be readable...
> Oh, and you can/should add comments also. so:
>
> s/(foo|bar)//;
>
> can be
> s/
> ( # either
> foo
> | # or...
> bar
> )
> //x;
>
>
> very simplified, but the basic point is there. Make things
> readable, comment, etc....
>
> --
> Jayce^
>
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */
>
More information about the PLUG
mailing list