http://www.perlmonks.org?node_id=917305


in reply to Im not sure what this regex is called or how to write it

There's nothing map can do that cannot be accomplished by a loop. Unless you are after one-liner bragging rights, your cascading filters are likely to be a good deal easier to understand (and extend, and get right) than a single complicated regular expression. My advice would be to use the cascading filters unless there is a really compelling need not to.