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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:05:24+00:00 2026-06-15T02:05:24+00:00

I have a string that contains a odd money value. The string is: Daily

  • 0

I have a string that contains a odd money value. The string is:

Daily interest charges #901 $ 17.2789 259.18 190.07/day

The odd value is $ 17.2789

I am trying to create a regular expression that will get is, but not have a back reference. This is what I have come up with:

(?:\\$\\s*?\\d{0,1,2,3}\\.\\d{0,1,2,3,4}\\s*?/?day)?

This however will not compile. Everything in there seems reasonable to me? Any idea what might be wrong with it? I am using Java

EDIT

I have tried m.buettner suggestion of \\$\\s*\\d*\\.\\d*. I places it in the 3rd grouping below. This almost does it. Here is my full regular expression:

(.*)\s?#(\s?\d{3,4})\s*(?:\$\s*\d*\.\d*)?((?:-|\()?\$?(?:\d{1,3}[ ,]?)*(?:\.\d+)\)?)\s*((?:-|\()?\$?(?:\d{1,3}[ ,]?)*(?:\.\d+)\)?).*

The groups it pulls are:

  1. Daily interest charges
  2. 901
  3. 9 259.18
  4. 190.07

It is grouping 3 that is the issue. It contains one extra digit, the first 9

Edit Edit

There was a space that was causing the issue, this did it:

(?:\$\s*\d*\.\d*\s)?

  • 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-15T02:05:25+00:00Added an answer on June 15, 2026 at 2:05 am

    As far as I know \\d{0,1,2,3...} is not valid syntax. What you meant was probably:

    (?:\\$\\s*?\\d{0,3}\\.\\d{0,4}\\s*?/?day)?
    

    Also, are you aware that your whole pattern is optional? This poses a problem. \\d{0,3}\\.\\d{0,4} will only match the first (odd) number. Then you have an optional slash, but a mandatory day (if the whole pattern is not dropped). But in your input string there are a few other numbers before /day is encountered. So even if it compiles, it won’t match your price value. You should probably leave out the \\s*?/?day altogether. And think about removing the outer ?, too. And as Brian stated in the comment, there is no need to make the \\s repetition ungreedy, since it and the following element are mutually exclusive anyway:

    \\$\\s*\\d{0,3}\\.\\d{0,4}
    

    And do you really have to be so specific about the number of digits if the value is “odd” anyway?

    \\$\\s*\\d*\\.\\d*
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string that contains HTML image elements that is stored in a
I have a string that contains ampersands. I need to escape each ampersand in
I have a string that contains a known number of double values. What's the
I have a string that contains a czech character. the string is 0bálka This
If I have a string that contains a url (for examples sake, we'll call
Suppose I have a string that contains Ü. How would I find all those
If I have a string that contains the html from a page I just
If I have a string that contains Cat how could I check before hand
The question is simple. I have a string that contains multiple elements which are
I have a query string that contains a variable like this $field_name = 'features';

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.