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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:28:30+00:00 2026-06-14T09:28:30+00:00

This should be simple to someone who is good with regex: I have a

  • 0

This should be simple to someone who is good with regex:

I have a string like var str="<a class='removable'>$10 STNA Workbook <br/></a>";

and I am able to extract the number which was my first issue. Now the more difficult task is extracting the, in this case “STNA Workbook”. However the issue is this statement can be 1, 2, 3, 4 or however many words long. So i need to match everything between the number and < br/>

What my last attempt looked like var patt1=(\d)(.*?)\[<\];

also a quick explanation of the regex parts would be greatly appreciated but not absolutely necessary as I am trying really hard to learn this.
any help would be great thanks.

  • 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-14T09:28:31+00:00Added an answer on June 14, 2026 at 9:28 am

    You were pretty close.

    var matches = str.match(/(\d+)(.*?)</);

    matches[1] will contain the number and matches[2] will contain the words

    You know what the \d (matches digits) is. The (.*?) is a non-greedy match for any character and < ends the non-greedy match

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

Sidebar

Related Questions

This should be a simple one for someone who gets regex. I have a
This should be very simple for someone who knows regex. I don't need anything
I'm very poor with regexps but this should be very simple for someone who
This should be simple, but I'm getting confused. I have a parent/child tables -
This should be simple, yet I can't get it to work. I have a
Hey guys this should be simple, I'm just not seeing it, I would like
Seems like this should be simple, but powershell is winning another battle with me.
This should be simple task but i am not been able to find the
This should be simple, but the answer is eluding me. If I've got a
This should seem simple enough, but can't figure it out. I was porting a

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.