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 340607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:37:54+00:00 2026-05-12T10:37:54+00:00

We have a database where every table name starts with WW. I want to

  • 0

We have a database where every table name starts with WW.
I want to display an SQL on a web page, but wrap each table name with a link.
For example:

"select * from wwx_something where ..."

Should be transformed into:

"select * from <a href='/table/wwx_something/'>wwx_something</a> where ..."

There might be several tables, of course, and it should not be case-sensitive.

I need a javascript regex solution…I can’t seem to get it to 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-05-12T10:37:54+00:00Added an answer on May 12, 2026 at 10:37 am

    Solution using a single replace:

    var re = /(FROM|JOIN)\s+(WW\S+)/gi;
    yourText.replace(re, "$1 <a href='$2'>$2</a>");
    

    note that I also tentative support for stuff such like “SELECT * FROM wwa JOIN wwb”.

    ADDED after comment: yes, you can replace with a custom function in order to uppercase the URL:

    var re = /(FROM|JOIN)\s+(WW\S+)/gi;
    function change(s, p1, p2) {
        return p1 + " <a href='http://whatever/" + p2.toUpperCase() + "'>" + p2 + "</a>";
    }
    yourText.replace(re, change);
    

    PS: IMHO it’s better to include FROM/JOIN in the match because this way you’re better warded about strays “ww” that have nothing to do with table names… including a bit of context always helps disambiguate.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that needs to check a database table every minute. The
I have two tables Team_DATA and Driver_PROFILE_DATA in an SQL database. For every driver_profile
I have a database table, with people identified by a name, a job and
I have a database that i'm dealing with which is updated every few hours
I have a database that has a vessel pressure that is trended every 30
I used to have a situation where I hit the database a every time
I have a script that automatically populates a mysql database with data every hour.
I have a high score database for a game that tracks every play in
I have database with many tables. In the first table, I have a field
I have database application, I want to allow the user to restore the deleted

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.