Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: RegExp

  1. #1
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    RegExp

    Hey all. Currently, I'm learning how to make scripts for InvisionFree boards. Right now, I'm trying to build a script so my board has a store on it. The only problem is, I don't have enough javascript knowledge to do so. Here's the code I have right now, and what I need help on is RegExp.$1, both what it is, and how it can be used. I was told by a coder that it is used to grab the post count off of the showuser= page, but I'm not totally sure how to execute RegExp. If anyone can help me out with this, that would be great. Here's my current code:

    Code:
    var reqObject;
    function getUser(url){
    url ="http://s#.invisionfree.com/YOUR_BOARD/index.php?showuser=" + url;
    
    if (window.XMLHttpRequest || window.ActiveXObject)  {
     reqObject= (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
     reqObject.onreadystatechange=get_post_count;
     reqObject.open("GET",url,true);
     reqObject.send(null);
    }
    }
    
    function get_post_count(){
    if(reqObject.readyState == 4 && reqObject.status == 200){
      /* You'll get the reqObject.responseText here, which is all the HTML
          of the page.
      */
    }
    }

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    The RegExp.$x (where x is one of $, _, 0, 1-9, &, +, `, ') syntax is deprecated. It contained data having to do with the last regex match, but that data is now better accessed in the form of the array returned by RegExp.prototype.exec (or String.prototype.match if the regex has no global flag).
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    Regular Coder
    Join Date
    Aug 2005
    Posts
    282
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I see no RegExp in your source code? What do you want it to actually do for you?

  • #4
    New to the CF scene
    Join Date
    Jan 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the RegExp info


    I was messing around earlier, and I was curious if there was an easier way to grab info from a different location. Does anyone know of a way other than xmlhttp? It would make finishing this code a helluva lot easier.

    Thanks again for helping

  • #5
    fci
    fci is offline
    Senior Coder
    Join Date
    Aug 2004
    Location
    Twin Cities
    Posts
    1,345
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, you could just query the data or call whatever the functions are to generate what you want, or include it etc


  •  

    Posting Permissions

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