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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:17:55+00:00 2026-05-23T10:17:55+00:00

I wrote a very basic jquery script to obtain the src attribute from my

  • 0

I wrote a very basic jquery script to obtain the src attribute from my img elements. Long story short, based on the number contained in the src attribute of my thumbnails, the code then uses that same id number to fetch the corresponding main image:

sample thumb src value: catalog/p1-t1.png | where p = piece and 1 = id, t1 = thumb 1
sample mainpic src value: catalog/p1-1.png | where p = piece and 1 = id, 2nd 1 = main pic for thumb 1

It all worked nicely up until single digit numbers became double digits and thus, using something like:

$string = $string.substring(12,13);

ceased to work (obvious yes).

I want to get from my thumb’s ‘catalog/p1-t1.png‘ src value the ‘1’ after the ‘t’, whether its t1 or t33 or t999.

Thanks in advance
G.Campos

  • 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-23T10:17:56+00:00Added an answer on May 23, 2026 at 10:17 am

    A wild Regular Expression appears!

    var string = 'catalog/p1-t666.png',
        re = /\/p(\d+)-t(\d+)/
        result = re.exec(string),
        piece = result[1], // 1
        thumb = result[2]; // 666
    

    Oh and later a slightly less wild demo appears, I guess.

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

Sidebar

Related Questions

Very basic question: how do I write a short literal in C++? I know
I wrote a tab system using some very basic Javascript and it runs like
Ok, so here is a code for a very very very basic jQuery lightbox,
This is a very basic question for JUnit testing. I wrote a program which
I wrote a simple batch file as a PowerShell script, and I am getting
I wrote a windows service using VB that read some legacy data from Visual
A bit of background first: GeoModel is a library I wrote that adds very
I came across something very basic but extremely bewildering today. I needed to convert
I'm trying to decide how to implement a very basic licensing solution for some
I recently wrote a node-based stack class, per instructions (specs in the comments before

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.