in reply to doing tr/// on-the-fly?
My second question lies in making these strings more complicated -- to the point of containing regular expression metacharacters.tr/// does not support regular expressions:
Note that tr does not do regular expression character classes such as \d or :lower:. The tr operator is not equivalent to the tr(1) utility. If you want to map strings between lower/upper cases, see lc and uc, and in general consider using the s operator if you need regular expressions.
Obviously I need to escape them,If you do end up using s///, you can escape the regular expression using quotemeta.
Is there a default module which does such escaping, or is there a CPAN module which does what I need?Probably. Can you show more small examples of what you are trying to replace?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: doing tr/// on-the-fly?
by Anonymous Monk on Mar 18, 2010 at 17:52 UTC |