1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

regular expression implementation help please

Discussion in 'C#' started by grobar, Aug 13, 2006.

  1. #1
    Okay, so ive got a regexp that works perfectly in an online tester. I am having trouble implementing in my existing code.
    SEMrush
    It takes a variable (xmlhttp.responseText) that holds an external page's source code, and checks it for the existance of a link to a specified domain. It should then show ONLY the HTML for that link, and then break it up in the sub strings.

    What it DOES do currently, is return the whole string, EXCEPT the link it should, in effect doing the opposite.

    Any help is appreciated. Source code i'm checking against to test is http://www.robarspages.ca/index.asp and looking for the link to billiardsforum.info.

    The VB code thus far:

    
    url = objRSanc("la_blt_link_url")
    
    set xmlhttp = server.CreateObject("MSXML2.ServerXMLHTTP")  
    on error resume next 
    xmlhttp.open "GET", url, false 
    xmlhttp.send ""  
        
    if err.number <> 0 then 
    VerifyUrl=false
    response.redirect("http://www.google.com/?0000000000000000000000")	
    else 
        
    set regizzo = New RegExp
    regizzo.Pattern = "(<[^>]*?a[^>]*?(?:billiardsforum.info)[^>]*>)((?:.*?(?:<[ \r\t]*a[^>]*>?.*?(?:<.*?/.*?a.*?>)?)*)*)(<[^>]*?/[^>]*?a[^>]*?>)"
    
    regizzo.Global = True
    regizzo.IgnoreCase = True
    
    dim stipulation 
        
    stipulation = regizzo.replace(xmlhttp.responseText, "$2")
        
    response.write stipulation     
    
        
    Set regizzo = Nothing
        
    dim updiz
    Set updiz = Server.CreateObject("ADODB.Connection")
    updiz.Open strdbee
    Set objRSupd = Server.CreateObject("ADODB.RecordSet")
    
    strsqlu = "UPDATE la_blt SET la_blt_link_anchor='somevar' WHERE la_blt_id =44"
    objRSupd.Open strSQLu, updiz, adLockOptimistic
    	
    end if
        
    
    response.write("done.")
    %>
    
    
    
    Code (markup):
     
    grobar, Aug 13, 2006 IP
    SEMrush