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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:00:49+00:00 2026-06-16T17:00:49+00:00

In Javascript: I have a sentence this is a test123 and i need to

  • 0

In Javascript:

I have a sentence “this is a test123” and i need to match the group of numbers following the word test.

Is there a way to do this other than with using groups?

This is what i got, but i’d like to make this work without using a group (if possible)

var str = str.match(/test.([0-9]{1,3})/)

Basically i just need to say “any number group preceded by ‘test'”

  • 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-16T17:00:50+00:00Added an answer on June 16, 2026 at 5:00 pm

    Simple single line of code (yet groups, but simple):

    "this is a test123".replace(/.*test(\d{1,3}).*/, "$1");  // "123"
    

    Or another version with match:

    ("this is a test123".match(/test(\d{1,3})/) || []).pop();  // "123"
    

    And one more single line without regex:

    parseInt("this is a test123".split("test")[1], 10);  // 123
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does JavaScript have a convenient way to test if a variable matches one of
Possible Duplicate: Does JavaScript have a range() equivalent? Is there a way to declare
var object = {foo: 'bar'}; Does JavaScript have a way to determine that object.foo
I have javascript code some thing like this -- var count=3; var pl=new Array(count);
I have Javascript function defined in the main index.html file. One part of this
I have javascript code embedded inside a html template file. When I load this
Using Javascript, I need to allow a user to double click a word on
i have a question to deserialize JSON text to an javascript object, i test
Does JavaScript have a way of truncating HTML text without all the headaches of
First, does JavaScript have no basic Date comparision the way Python might? In my

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.