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

  • SEARCH
  • Home
  • 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 8092885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:22:56+00:00 2026-06-05T20:22:56+00:00

I’m feeling fairly frustrated, because I feel like this is probably very easy/obvious and

  • 0

I’m feeling fairly frustrated, because I feel like this is probably very easy/obvious and I’m just not putting the pieces together. I’m trying to create a GM script that will look at each URL in a table, extract one piece of each URL (unique for each entry), and then insert a new link that’ll appear after each entry.

Here’s an example of what the HTML would look like:

<table border="1" cellpadding="1" cellspacing="0" width="400">
<tbody>
<tr>
    <td>
        <a href="http://website.com/names/1936">joseph smith</a>
    </td>
    <td>11</td>
</tr>
<tr>
    <td>
        <a href="http://website.com/names/1756">john smith</a>
    </td>
    <td>1</td>
</tr>
<tr>
    <td>
        <a href="http://website.com/names/350466">scott smith</a>
    </td>
    <td>0</td>
</tr>
<tr>
    <td>
        <a href="http://website.com/names/789533">adam smith</a>
    </td>
    <td>6</td>
</tr>
</tbody>
</table>

I’d like, for each entry, to identify the number that comes after “/names/”, which is unique to each name and is not always the same length. Then I’d like to insert a new link after the one already there, like this:

<a href="http://website.com/names/[number]/edit">[number]</a>

For a basic example of how it would look, I’d like this (for each entry):

<tr>
    <td>
        <a href="http://website.com/names/1936">joseph smith</a> <a href="http://website.com/names/1936/edit">1936</a>
    </td>
    <td>11</td>
</tr>

Any help would be much appreciated. As I said, I feel as if I’m a bit dense, and that this should be a lot simpler than I’m making it out to be. I’ve been trying to figure it out for days, and I can’t seem to get anywhere (I’m not fully proficient at javascript yet!).

Update: for clarification, my difficulty is doing what I believe are three things:
1) identifying these specific URLs (as opposed to any other that might appear elsewhere in the table or page
2) extracting the number from the URLs
3) inserting the new link after each of these links

I don’t have the ability to change the HTML code already there, to give IDs for example.

  • 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-05T20:22:57+00:00Added an answer on June 5, 2026 at 8:22 pm

    Here’s a complete script that shows how to do this using jQuery, and with CSS styling to make it look better:

    // ==UserScript==
    // @name     _Add edit links after user links
    // @include  http://YOUR_SERVER.COM/YOUR_PATH/*
    // @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
    // @grant    GM_addStyle
    // ==/UserScript==
    
    //--- This next selector is highly page-specific.
    var nameLinks   = $("td a[href*='names']");
    nameLinks.each ( function () {
        /*---   From: <a href="http://website.com/names/1756">john smith</a>
                Make: <a href="http://website.com/names/1756/edit">Edit user 1756</a>
                (Plus some housekeeping.)
        */
        var newURL  = this.href.replace (/names\/(\d+)$/i, "names/$1/edit");
        var userNum = RegExp.$1;    // Special feature of replace().
    
        $(this).after (
            '<a href="' + newURL + '" class="gmEditLink">Edit user ' + userNum + '</a>'
        );
    } );
    
    GM_addStyle ( '                         \
        a.gmEditLink {                      \
            margin-left:            1em;    \
            font-size:              80%;    \
            vertical-align:         super;  \
        }                                   \
    ' );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm not entirely sure how I managed to jack this up. http://pretty-senshi.com If you
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am trying to render a haml file in a javascript response like so:

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.