> > > Dave Storrs wrote: > > > Can we please have a 'reverse x' modifier that means "treat whitespace as > > > literals"? Yes, we are living in a Unicode world now and your data could > > > > > > /FATAL ERROR\: Process (\d+) received signal\: (\d+)/ > > > > I don't see how this example is nearly as flexible as this: > > > > m:w/FATAL ERROR\: Process (\d+) recieved signal\: (\d+)/ > > > > Yours will only match 4 spaces after FATAL ERROR:, whereas mine will match > > any number. [...] > > I see the :w modifier as a good flexibility enforcement. It will > > keep people away from matching things that very literally. > > However, the point I was making was that, if I feel confident in > only handling a limited subset of the possibilities because I know what > I'm going to be getting (because, e.g., I wrote it out myself), then I > would like a way to do away with the visual clutter involved in > backwhacking or entity-izing every bit of whitespace. Perl has never been > a nanny-language...one of its greatest strengths has always been that it > trusts me to make my own decisions and, if I want to shoot myself in the > foot, I can. :> >
Fair enough. You're going to have to take off the safety on the gun before you try to shoot yourself in the foot, though. I'd do it this way: /<'FATAL ERROR: Process '> (\d+) <'received signal: '> (\d+)/ I think that's the syntax... I know there was a way to match a literal string. Personally, that doesn't seem like a pain at all, and it's nice to the reader. > The suggestions that other people have been making about defining > subrules and then building them up in order to make the entire match are > good, and in general that's a very powerful technique. However, the lines > devoted to those subrules still count as visual clutter, and I'd still > like a way to do away with them. Good point. Subrules would be a pain for a quick-and-dirty one (or two) liner. Luke