in reply to Need regexes with alternations in them for testing perl...

A request for real life regepx with alternations, well that's fun !

Here's one that i use to do some matching on HP-UX iostat output :

m/^ ( NANQ|INF|NANS| # Possible non numerics \d+ # a number ... (?:[,\.]\d+)? # ... with an optional decimal part ) # memorise the value of : tin . \s+ ( NANQ|INF|NANS| # The same one \d+ (?:[,\.]\d+)? ) # memorise the value of : tout . \s+ (?:[\d\s\.,]|NANQ|INF|NANS)+ # Rest of the line . $/x
The non numeric values were added afterwards, after they showed in some iostat output were i did not expected them. The regep thus allowed me to fix an annoying behaviour with minimal impact.

Another one :

s/^\d\d:\d\d:\d\d\s*(?:CPU|INTR)\s*//
This is some sar linux result line .

Now some vmstat with sunOS:

s/de\s+sr\s+(\w\d|\w\w|\w\w\d|--|\s)+in\s+sy/de sr in sy/g

Cheers,
zlr.