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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:40:07+00:00 2026-06-03T20:40:07+00:00

I am extracting a string from a database which needs to be parsed into

  • 0

I am extracting a string from a database which needs to be parsed into latitude and longitude separately,
The string is defined as a “point”, in the following format:

(2.340000000,-4.50000000)

I am trying to remove the parenthesis, and then parsed them with the method split() but I haven’t been able to come up with a regular expressions that does the job right:

So far I have tried many alternatives, and

var latlong = "(2.34000000, -4.500000000)"
latlong.replace('/[\(\)]//g','');
var coords = latlong.split(',');
var lat = coords[0];
var long = coords[1];

If I run that, all I got is:
NaN, -4.500000

What am I doing wrong?
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-03T20:40:10+00:00Added an answer on June 3, 2026 at 8:40 pm

    Seems to work, but you had an extra slash

    var value = '(2.340000000,-4.50000000)';
    
    //you had an extra slash here
    //           ''''''''''''''''v
    value = value.replace(/[\(\)]/g,'').split(',');
    
    console.log(value[0]);
    console.log(value[1]);​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am extracting some text from html which is passed as a string. The
Need some help with extracting 2 pieces of information from the following string: viewed
I am getting a string from Twitter into my Actionscript which is a unformatted
In Python, I am extracting emails from a string like so: split = re.split("
I'm extracting files from zip and rar archives into raw buffers. I created the
Im having trouble extracting only a matching string: OPER^ from a log4j file. I
I'm extracting a string from wikipedia API that initially looks like this: link text
I have a problem that sscanf solves (extracting things from a string). I don't
How would I go about extracting just the base URl from a long string
I am extracting string from an byte array. The string is a sql script.

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.