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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:46:23+00:00 2026-05-27T02:46:23+00:00

I asked a similar question on how to do this on the server side

  • 0

I asked a similar question on how to do this on the server side (SQL), however it makes more sense to accomplish this on the client side, based on the app architecture.

I’ve got a MVC3 app with Razor on the .Net framework, where I have model data available that I would like to parse and return the first dollar value from a given string using Javascript / regex,

For example, each of the following lines represents a sample data set:

Used knife set for sale $200.00 or best offer.
$4,500 Persian rug for sale.
Today only, $100 rebate.
Five items for sale: $20 Motorola phone car charger, $150 PS2, $50.00 3 foot high shelf.

I’ve seen a few issues already including the @ in JS and a few other pitfalls I would like to try to avoid.

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-05-27T02:46:23+00:00Added an answer on May 27, 2026 at 2:46 am
    var m = line.match(/\$[0-9,]+\.?\d*/);
    if (m)
        return m[0];
    

    should give you a hint. This Regex returns you a string which consists of a dollar sign, some numbers or commata, and optional a dot another few numbers behind it. You might want to limit its wideness (only 2 decimals, not starting with zero etc).

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

Sidebar

Related Questions

This is similar to a question that has already been asked. However, I am
I asked this similar question and got a satisfactory answer. However, doing the same
I have already asked a similar question on this, however after seeing the railscast
I asked a similar question about this previously, but I did not specify that
Liu Chang asked a very similar question to this one here, Linux equivalent of
I found this on Google, click here , which someone asked a similar question,
This is similar to this question I asked last week. My dataGrid is populated
I asked a similar question like this yesterday but after waiting for ever I
I already asked a similar question but this one is a bit different/specific: I'm
This question is very similar to the question asked here so I hope this

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.