My ruby problem of the day: I have e-mail addresses, and I want to use them within procmail rules. Therefore certain characters like the dot character and also the “+” need escaping.
It took me an endless while, like certain things always take an endless while on unknown grounds.
I started with single quotes just as in the gsub examples in the pickaxe3 book.
I didn’t get the right number of backslashs in place within the replacement string, as long as the replacement string used single quotes.
Finally a Google search for “ruby gsub replacement backslash” led me to a solution. Not to an overly serious one, to be honest.
The example there used double quotes, so I replaced my single quotes with double quotes, and I started again increasing the number of accumulated backslash characters. That way I achieved within a pretty short time, what I needed to achieve. Not that I had learned too much.
Leave a Reply