[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] About s/foo/bar/x



Richard Gordon wrote:
> 
> Can somebody straighten me out about the x switch in MacPerl regex? What I
> *thought* was that it was just a formatting tool that said "ignore white space"
> in the composition of the expression so that you could break these things up
> like:
> s/  (exp 1)     #comment
>     exp 2       *comment
>     (exp 3)/    
>     $3$1/gsx    #comment
>     
> However, when I use this, regexen that were working fine suddenly go
> blind and it appears to me that whitespace is also being ignored in the
> target text. So, have I just completely misunderstood this and, if I
> have, what possible use is the x switch if it is going to alter MacPerl's
> behavior in dealing with something as prevalent and wildly varying as
> white space?
> 
> Inquiring minds want to know. 
>     

Not enough information.

What does the actual regex look like?  (I'll be it doesn't use an asterisk
as a comment character.)

What is the actual target string?

What the hell does 'go blind' mean in the context of regular expressions?


Note that /x applies only to the pattern, not to the replacement.  Did you
really want that extra whitespace in the replacement string?


Ronald

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org