How to Replace ?

Results 1 to 2 of 2

Thread: How to Replace ?

  1. #1
    Join Date
    Dec 1969

    Default How to Replace ?

    Hi,<BR><BR>I am trying to figure out a way to replace all the semicolon with a period in the entire string, if the semicolon comes after a date. Only spaces are allowed between date and the semicolon.<BR><BR>For example "My party is scheduled on 5/1/2002; His party is postponed; but Janes party will be held on 5/2/2003 ; I will see you there."<BR><BR>This sentence has to change into "My party is scheduled on 5/1/2002. His party is postponed; but Janes party will be held on 5/2/2003. I will see you there."<BR><BR>The pattern I am using is "(d{1,2}[/&#124-]d{1,2}[/&#124-](dd){1,2})s*(;)"<BR><BR>It looks like the pattern is correct.But I can not seem to get the replace function working correctly. Pls help.<BR><BR>Thanks<BR>-GJK<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: How to Replace ?

    Try something like this:<BR><BR>Set re = New RegExp <BR>re.Global = true <BR>re.IgnoreCase = true <BR>re.Pattern = "(dd?[-/]dd?[-/]dd(dd)?)s*;"<BR>myText = re.Replace(myText,"$1.")<BR><BR>See the following post for more info:<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts