RegExp Help

Results 1 to 2 of 2

Thread: RegExp Help

  1. #1
    Join Date
    Dec 1969

    Default RegExp Help

    I am using theXMLHTTP component to read an ASP script output into a variable. I use Reg Exp to read through this variables to select the title of the document. This part works. <BR><BR>The next part I want to select a section of the text between delimters I have. The property objRegExp.Test(strSTring) gives the value FALSE so I assume my pattern is incorrect as it can&#039;t match it.<BR><BR><BR>RegExp.Pattern = "&#060;!-- START PRINTPAGE --&#062;(.*?)&#060;!-- END PRINTPAGE --&#062;"<BR>RegExp.Global = true<BR>RegExp.IgnoreCase = true <BR><BR>RegExp.Test(strString) &#039;returns false at present i.e. no match<BR>set objMatches.Execute(strSTring)<BR><BR>Any suggestions ? <BR><BR>Thanks <BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: RegExp Help

    If the desired text between the tags spans multiple lines, and you want to get everything in between (not sure what the ? is for) then I had the same problem as you. I think you need the RegExp.Multiline property set to true (you can only do that if you have VBScript 5.5). Without multiline set, it only checks through one line.<BR><BR>I only have VBScript 5.1. So, to solve this problem, I used regexp to get a match on my starting tag and got its FirstIndex property out. Then got a match for the end tag and got its FirstIndex. Then I used the Mid() function to rip out the multiline text in between the two tags.<BR><BR>If this helps and you want more specifics or to see my code, just ask.

Posting Permissions

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