Re: Help with regex
[email protected] (Michael Running Wolf) Thu, 13 Aug 2009 22:06:52 -0700
| Newsgroups | perl.fwp |
|---|---|
| Message-ID | <[email protected]> |
On Aug 13, 2009, at 11:51 AM, John Douglas Porter wrote:
> Maybe this is too obvious...
> and I know it's not regex...
>
> tr/A-Z/22233344455566677778889999/;
It's a beautiful and elegant piece of SWIM (Say What I Mean) code.
The following formatting makes the mapping a bit more visually
obvious, especially with a fixed width font, though golfers may object
to the whitespace and the range expansion.
tr {abc def ghi jkl mno pqrs tuv wxyz}
{222 333 444 555 666 7777 888 9999};
Michael Wolf