strip text from specific html tags

Results 1 to 2 of 2

Thread: strip text from specific html tags

  1. #1
    Join Date
    Dec 1969

    Default strip text from specific html tags

    hi<BR>trying to get my head around regexps ;-)<BR>wanting to strip text between specific html tags:<BR>i.e &#060;title&#062;this is my site&#060;/title&#062;<BR><BR>"&#060;title&#062;*?&#060;/title&#062;" returns all data to screen?<BR><BR>Any help would be appreciated...<BR>Bryan<BR>

  2. #2
    spg Guest

    Default RE: strip text from specific html tags

    objRE.pattern = "&#060;" & tagName & "[^&#062;]*&#062;([sS]*?)&#060;/" & tagName & "&#062;"<BR><BR>should do the match for you (set tagName = "title" or whatever.<BR><BR>the first part matches the opening of the first tag, the nubbits (oh so technical -- [^&#062;]*) matches, or rather skips, all of the element attributes you don&#039;t care about. The next bit ([sS]*?) groups and records everything (whitespace or not whitespace, to be precise) after the opening tag until it gets to what looks like a closing tag (that&#039;s the *? -- everything until next bit). <BR><BR>It&#039;s been ages since I&#039;ve done these in VBS, so I&#039;m afraid the pattern is all I can offer. But I think the complete solution goes something like<BR><BR>set objMatches = objRE.execute(strSourceCode)<BR>for each objMatch in objMatches<BR>response.write objMatch.subgroups(0).value<BR><BR>but don&#039;t quote me on that; check out instead.<BR><BR>HiHSPG

Posting Permissions

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