home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!uvaarpa!mmdf
- From: Kevin Burton <noran!iowa!kburton@uunet.uu.net>
- Subject: Case dependent substitution
- Message-ID: <1992Sep9.191433.25724@uvaarpa.Virginia.EDU>
- Sender: mmdf@uvaarpa.Virginia.EDU (Mail System)
- Reply-To: noran!iowa!kburton@uunet.uu.net
- Organization: The Internet
- Date: Wed, 9 Sep 1992 19:14:33 GMT
- Lines: 22
-
-
- I would like to substitute an arbitrary pattern for another, but it all of
- the alphabetic characters in the source pattern are upper case I would like
- to case the replacement pattern to also force upper case substitution.
-
- For example:
-
- substitute "abc" in "ABCxyzabc" with "xyz" produces "XYZxyzxyz"
- substitute "abc" in "abcxyzABC" with "xyz" produces "xyzxyzXYZ"
-
- I have started to work on a solution that first searches the string for pattern
- matches, checks the mathched patten, then finally makes the appropriate
- substitution. This "brute force" method doesn't seem very elegant or efficient
- and I was wondering if any of the more experienced perl users could give me
- a tip ?
-
- Thanks.
-
- kburton@noran.com
-
-
-
-