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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:25:49+00:00 2026-05-23T23:25:49+00:00

I have a script that gets the output after a ping, the output looks

  • 0

I have a script that gets the output after a ping, the output looks like this:

var input = "PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.065 ms
64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.073 ms
64 bytes from localhost (127.0.0.1): icmp_req=3 ttl=64 time=0.065 ms

--- localhost ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.065/0.067/0.073/0.010 ms"

I was first trying to get how many packets that was transmitted. So I tried with this regular expression: (\d+)*\spackets

Basically to match on the “NUMBER packets” it seems to work on this site: http://www.regular-expressions.info/javascriptexample.html but I can’t replicate it.

And when using the regular expression with match, it also fails, like this:

"42 packets".match('(\d+)*\spackets');

Any ideas?

  • 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-23T23:25:50+00:00Added an answer on May 23, 2026 at 11:25 pm

    Javascript regex must be surrounded by forward slash delimiters to indicate a RegExp object, not quotes:

    "42 packets".match(/(\d+)\spackets/);
    

    Which is short form for:

    "42 packets".match(new RegExp('(\d+)\spackets'));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Ruby script that looks like this require 'csv' while line
I have written a bash script that gets three paths based on input parameters
I have a utility build script that gets called from a variety of project-specific
I have a web scraping script that gets new data once every minute, but
I have a complex Powershell script that gets run as part of a SQL
I have a script that allows users to 'save as' a pdf, this is
I have a table with weekly data that looks like: userID Site date ------
I'm writing a simple php/mysql script that gets all ads I have in my
Ok, so I have this PHP script that runs in a nice little infinite
I have this output(from another system) that I need the Test field to be

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.