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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T14:16:03+00:00 2026-06-02T14:16:03+00:00

I didn’t get a suitable regex that enable to split such string: 72 g

  • 0

I didn’t get a suitable regex that enable to split such string:

72 g tocirah snaeb 101 sgge 108 g darl 111 spuc loi 32 sinihccuz

into strings basing on numbers first occurences like so:

72 g tocirah snaeb, 101 sgge, 108 g darl, 111 spuc loi, 32 sinihccuz 

How can i do that:

var str="72 g tocirah snaeb 101 sgge 108 g darl 111 spuc loi 32 sinihccuz";
var regex="/  /";
var result=str.match(regex);
  • 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-02T14:16:05+00:00Added an answer on June 2, 2026 at 2:16 pm

    Use:

    var result=str.replace(/ (\d+)/gm, ", $1");
    

    Search pattern: search an space char followed by one or more numbers and capture the number.

     / (\d+)/gm
    

    Replace: replace by a , followed by the captured number.

    , $1
    

    You can test it here: http://jsfiddle.net/2FwKF/3/

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

Sidebar

Related Questions

I didn't get an optimized regex that split me a String basing into the
I didn't quite get / see what I was hoping for and maybe missed,
i didn't really know how to title this question, but here's a thing that
I didn't find it on their doc http://www.sqlite.org/lang_corefunc.html So just want to get confirm
I didn't get any overlay change when my teammates make changes or add a
I didn't use Prototype.js before, when I use jquery, I can get an element
(Didn't mean to create a new question, but revised the old one enough that
I didn't find anything about that. Here's my query: SELECT p.*, pa.*, a.* FROM
Didn't know how else to put this. Say I have a JavaScript method that
Didn't find how to do that. What I found was more or less on

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.