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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:21:49+00:00 2026-06-06T02:21:49+00:00

I have a text like this. Mr John Smith , Mr James Smith +(21)-(21)-12345678,

  • 0

I have a text like this.

Mr John Smith , Mr James Smith                  +(21)-(21)-12345678, 12345678, 12345678                     +(21)-12345678, 12345678, 12345678        SomeTextHereAlso        +(21)-(22)-12345678                       www.somewebaddress.co.uk                            Some Title, Some Place , Some Town,Some Suburb,  City - 100000

I want to extract each of these strings using regex in javascript. I found some examples and this morning they worked. Now I don’t know why they don’t work any more.

To extract

Mr John Smith , Mr James Smith

I used this.

/\S(.*)\+/  and /\S(.*?)\+/

This didn’t work. I can’t figure out why.

To extract this

+(21)-(21)-12345678, 12345678, 12345678                     +(21)-12345678, 12345678, 12345678        SomeTextHereAlso        +(21)-(22)-12345678     

I used this.

/\+(.*)(?=www.)/

This did work.

And for url I used

/www(.*?)(?=\s\s)/

And this works too.

The only problem is the first example that should extract all the characters until the first + but it extracts all the characters until the last +.

I checked on http://gskinner.com/RegExr/?2tr5t and the examples I showed here work. Are there any more similar examples that could help me since I looked into the code and didn’t find any error.

If regex is fine then how can I use IndexOf() method for this example to extract what I want?

  • 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-06T02:21:50+00:00Added an answer on June 6, 2026 at 2:21 am

    You can try [^+]+ or more specifically ^[^+]+

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

Sidebar

Related Questions

I want to have some kind of file containing text, kinda like this: John.file:
I have some text like this: এর জন্য বুদ্ধির (Reason) প্রয়োজন নেই, প্রয়োজন নিজের
I have a text file of e-mails like this: 10:info@example.com;dev@example.com 12:john@host.com; George <g.top@host.com> 43:jim.p@web.com.;sue-allen@web.com
I have text like this format term: 156^^^:^^59 datainput Or term: 156^^^:59 datainput or
i have text like this div bla-bla end div i need to get only
I have a text like this: 'Rails on IIS7 http://is.gd/vWPn ' (it's a tweet
i have a text like this .... ======== 1079.tif Image Description : Vexcel-UCD-Level-3 ------------------
I have a text like this [name:roccos] [phone:123324324] [tags:abc def ghi] [id:value] How can
I have a text like this $text=The tower is 94.5m high, the view is
I have text to localize like this <p>Please enter your user name and password.

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.