JScript RegExp Help

Results 1 to 2 of 2

Thread: JScript RegExp Help

  1. #1
    Join Date
    Dec 1969

    Default JScript RegExp Help

    I need to replace a &#039; character with two &#039; so that I can insert the data into an Access database. I&#039;m having trouble finding the pattern to use with the String.replace() function. Does anyone know how to do this? <BR><BR>Example <BR>---------- <BR>original string: <BR>Source: Calculated from sum of Paid and Contracted FTEs/A.P.D.&#039;s from Blue Book <BR><BR>needs to be: <BR>Source: Calculated from sum of Paid and Contracted FTEs/A.P.D.&#039;&#039;s from Blue Book <BR>---------- <BR><BR>Thanks, <BR>Chris Bloom

  2. #2
    Join Date
    Dec 1969

    Default RE: JScript RegExp Help

    &nbsp;<BR>Not that this necessarily addresses your issue, as you don&#039;t mention the context of needing to do this in jscript/clientside, but i usually replace single &#039; with double &#039;&#039; using vbscript, on the serverside of the fence, and then insert it into the database (in my case SQL), eg:<BR><BR>strBody = Trim(Replace(Request("BodyText"), "&#039;", "&#039;&#039;"))<BR><BR>But, here&#039;s the msdn section on the replace() method:<BR>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsmthreplace.asp<BR><BR>They provide a fairly good example (see their first example of three) that should address your need. If not, post again with how it misses the mark, as i&#039;ve dealt with regexp a lot recently and would be happy to try and help out (again).<BR><BR>.rob adams

Posting Permissions

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