home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / perl / 5803 < prev    next >
Encoding:
Text File  |  1992-09-09  |  1.1 KB  |  34 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!uvaarpa!mmdf
  3. From: Kevin Burton <noran!iowa!kburton@uunet.uu.net>
  4. Subject: Case dependent substitution
  5. Message-ID: <1992Sep9.191433.25724@uvaarpa.Virginia.EDU>
  6. Sender: mmdf@uvaarpa.Virginia.EDU (Mail System)
  7. Reply-To: noran!iowa!kburton@uunet.uu.net
  8. Organization: The Internet
  9. Date: Wed, 9 Sep 1992 19:14:33 GMT
  10. Lines: 22
  11.  
  12.  
  13. I would like to substitute an arbitrary pattern for another, but it all of
  14. the alphabetic characters in the source pattern are upper case I would like
  15. to case the replacement pattern to also force upper case substitution.
  16.  
  17. For example:
  18.  
  19.     substitute "abc" in "ABCxyzabc" with "xyz" produces "XYZxyzxyz"
  20.     substitute "abc" in "abcxyzABC" with "xyz" produces "xyzxyzXYZ"
  21.  
  22. I have started to work on a solution that first searches the string for pattern
  23. matches, checks the mathched patten, then finally makes the appropriate
  24. substitution. This "brute force" method doesn't seem very elegant or efficient
  25. and I was wondering if any of the more experienced perl users could give me
  26. a tip ? 
  27.  
  28. Thanks.
  29.  
  30. kburton@noran.com
  31.  
  32.  
  33.     
  34.