In this case can you not consider spaces to be part of the 'word' ? In which case a direct replace would work. ie " HE " -> " SHE " " HIS " -> " HER " This would avoid "HELP" -> "SHELP" and "THIS" -> "THER"
Regards Gary Rathbone BSc MBCS Chartered Information Systems Practioner -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Dan Friedman Sent: 15 October 2002 23:41 To: [EMAIL PROTECTED] Subject: Search and Replace Greetings! I need to switch the gender of some text. But, I'm having a hard time figuring out a way to do it. Obviously I can't do a simple replace because Replace "HE" with "SHE" in someText Would turn "HELP" into "SHELP" I've written this function about a dozen times and it still isn't working perfectly. Here's what I have to date: ------------------------------------------------------------------------- function searchAndReplaceMaleToFemale TextToSearchNReplace set the caseSensitive to true set the itemDel to "," put "He,he,him,Him,himself,HimSelf,his,His,boy,Boy,he's,He's" into SearchWordsMale put "She,she,her,Her,herself,Herself,her,Her,girl,Girl,she's,She's" into SearchWordsFemale put TextToSearchNReplace into TextToSearchNReplace2 put quote&"!?,.:;[]{}()$%^&<>=+-#*\/" into tList repeat for each char tChar in tList replace tChar with space in TextToSearchNReplace2 end repeat repeat with i = the number of words in TextToSearchNReplace2 down to 1 if word i of TextToSearchNReplace2 is among the items of SearchWordsMale then replace (word i of TextToSearchNReplace2) with (item (itemOffset(word i of TextToSearchNReplace2,SearchWordsMale)) of SearchWordsFemale) in word i of TextToSearchNReplace end if end repeat set the caseSensitive to false return TextToSearchNReplace end searchAndReplaceMaleToFemale ------------------------------------------------------------------------- Anyone got any ideas? Thank you in advance, -Dan If you feel like taking a stab at it... Here's some text to test with: The Reading goals for Becky are building comprehension using specific strategies of [ answering questions, summarizing, and describing (beginning, middle, end)]. He will be able to use phonics to decode words, show an increasing his vocabulary, and gain fluency in oral reading. Becky will strive to be able to read at grade level or above by the end of the year. The Mathematics goals for Becky is to know the addition/subtraction facts, be able to solve word problems, gain a deeper understanding of place value, and demonstrate a basic understanding of time and money. The writing goal for Becky is to write a paragraph using clear and coherent sentences. Correct use of grammar, capitalization, and punctuation should increase as the year progresses for him. Personal Goals for Becky are to stay focused and on task to complete his work without adult supervision. Becky needs to make more productive use of class time. He is easily distracted and is often unable to finish his assignments in class. I am confident, with practice, Becky will learn how to use his time wisely. _______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution _______________________________________________ use-revolution mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/use-revolution