img tags

Results 1 to 2 of 2

Thread: img tags

  1. #1
    Join Date
    Dec 1969

    Default img tags

    I am trying to detect normal HTML img tags and replace them with their XHTML equivelance using regular expressions, i.e. find:<BR>&#060;img blah blah blah&#062;<BR>replace with:<BR>&#060;img blah blah blah &#062;<BR><BR>I can detect the img tags using the pattern tips given on the ASPFAQ site however I am not sure how to replace it with the above format.<BR><BR>Can anyone help?<BR><BR>Thanks in advance.<BR><BR>Afshin<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: img tags

    try this out, from what i tested it works. hope it will in your case as well. i&#039;m a bit new to regular expressions, so this might not be the best approach, but give it a try:<BR><BR>sPattern = "&#060;img[^&#062;]*&#062;"<BR>set objReg = new regexp<BR>objReg.Pattern = sPattern<BR>objReg.IgnoreCase = true<BR>objReg.Global = true<BR>set sMatch = objReg.Execute(sOutput)<BR>for each match in sMatch<BR> iLen = len(match.value)<BR> temp = mid(match.value, 5, iLen-5)<BR> sOutput = replace(sOutput, match.Value, "&#060;img " & temp & "&#062;")<BR>next

Posting Permissions

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