Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7868615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:03:37+00:00 2026-06-03T01:03:37+00:00

I am trying to make a Greasemonkey userscript which it will display info from

  • 0

I am trying to make a Greasemonkey userscript which it will display info from one website on another. I tried doing this with regular expressions, but got stuck on the match() syntax.

The page content is something like this:

<html><body>
<h1 class="pos-title">Fritz Paul</h1>
<div class="columns">
    <div class="pos-column1">
        <ul id="attributes">
             ... ...
        </ul>
    </div>
    <div class="pos-column2">
        <ul class="attributes">
             ... ...
        </ul>
    </div>
</div>
</body></html>

and I want to get only the:

<div class="columns">
    <div class="pos-column1">
        <ul id="attributes">
             ... ...
        </ul>
    </div>
    <div class="pos-column2">
        <ul class="attributes">
             ... ...
        </ul>
    </div>    
</div>


I’ve tried code like:

attibutes = responseDetails.responseText.match(xxxx);
playerNotesContent.innerHTML = attibutes;

I tried a lot of .match(...) examples that I found in this site but I can’t make it work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T01:03:38+00:00Added an answer on June 3, 2026 at 1:03 am

    As others have said, never attempt to parse HTML with regular expressions. Use DOM parsing instead.

    The question is not clear, but it appears that you are fetching a page via AJAX and attempting to parse it, right? Also, do you really want all the markup inside each <div class="columns"> or just specific bits of text?

    Here is the general approach for Greasemonkey. It uses jQuery to make DOM parsing easier.
    Updated based on OP’s comments and posted script. :

    // ==UserScript==
    // @name        _Parse Ajax Response for specific nodes
    // @namespace   http://www.test.com
    // @include     http://www.test.com/player/*/details.php
    // @require     http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
    // ==/UserScript==
    
    var player_id = document.location.pathname.match(RegExp('player/([^/]+)/details.php$'))[1];
    if (!player_id) { return; }
    
    GM_xmlhttpRequest ( {
        method: 'GET',
        url:    'http://www.test2.com/players/item/' + player_id,
        onload: function (responseDetails) {
                    var respDoc     = $(responseDetails.responseText);
                    var targNodes   = $("div.columns", respDoc);
    
                    $("#playerContent").after ('<div id="player_stats_block"></div>');
    
                    $("#player_stats_block").append (targNodes);
                }
    } );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im trying make one replace in string from a array but this dont work
I'm trying make this code which is from a Dictionary of Arrays (CODE) from
trying to make a page which will recursively call a function until a limit
I'm trying make a static text which if too long for the sizer, will
I'm currently trying to make a GreaseMonkey script that will allow a user to
I've just started to use Greasemonkey and am trying to make a userscript that
I'm totally new to GreaseMonkey, but I'm trying to make a little script. //
Trying to make a simple program to catalogue books. Something like this, for example:
Trying to make a simple program to catalogue books. Something like this, for example:
Trying to make simple minesweeper game in python, but have one problem. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.