On 03/10/14 15:37, Matt Zagrabelny wrote: > On Sun, Mar 9, 2014 at 5:58 PM, Teoh khah swee <ks.teo...@gmail.com> wrote: >> HI all, >> >> I just come across an case statement for puppet. I would like to know what >> the means of the mx for below sample code? >> >> case $::operatingsystem { >> /(?-mx:AIX)/ :{ > > From: > > http://perldoc.perl.org/perlre.html > > (?adlupimsx-imsx) > (?^alupimsx) > One or more embedded pattern-match modifiers, to be turned on (or > turned off, if preceded by - ) for the remainder of the pattern or the > remainder of the enclosing pattern group (if any). > > (?adluimsx-imsx:pattern) > > m: > Treat string as multiple lines. That is, change "^" and "$" from > matching the start or end of line only at the left and right ends of > the string to matching them anywhere within the string. > > x: > Extend your pattern's legibility by permitting whitespace and comments. > > I would then say that puppet is looking for AIX without capturing it > and has turned off the m and x options for this pattern match.
I don't know if Ruby regexps are really exactly the same as Perl regexps, but, to me as a Perl programmer, this regexp looks semantically identical to /AIX/, just with some added garbage to irritate people who don't know enough about regexps... ;-) No alternative or other grouping construct is used, thus the capture vs. collection functionality is irrelevant. The m flag modifier is turned off by default, no need to turn it off manually. The regexp has neither whitespace nor comments, thus the state of the x flag modifier is irrelevant either. But then, that's just from the viewpoint of an experienced Perl programmer; maybe Ruby is different here. Joachim -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Joachim Schrod, Roedermark, Germany Email: jsch...@acm.org -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/lfkrjk%24eq6%241%40ger.gmane.org. For more options, visit https://groups.google.com/d/optout.