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

  • Home
  • SEARCH
  • 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 6105183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:55:41+00:00 2026-05-23T13:55:41+00:00

This is a weird question, but bear with me… So, I’m messing around with

  • 0

This is a weird question, but bear with me…

So, I’m messing around with RegEx: I have the following code and it works fine if the inputText var contains a comma, however If I change it to “99 x icecream, each £99” it does not work… (i.e. it alerts null)

var inputText ="99, icecream, each £99";  // expensive ice cream

var inputText = inputText.toString(); // this was done because I though if I started a string with a number js might do that weird conversion stuff it does, but I don't need it right?

var qXpe = inputText.match(/(\d{1,3})(,|[ x ]?) (\w+), each ([£]\d+[.]?\d{0,2})/g);

alert(qXpe);

I want to find sentences which are structured quantity, product, £price or quantity x product, £price, the current regex works for the former.

So this regex returns 99, icecream, each £99 but null for 99 x icecream, each £99

Can anyone hazard a guess as to why this does not work? Merci.

  • 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-23T13:55:41+00:00Added an answer on May 23, 2026 at 1:55 pm

    The number should be followed by a space when it’s not followed by a comma but your regex doesn’t reflect that, cause [ x ]? means either a space or an x, optionally. Maybe you want ( x )?

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

Sidebar

Related Questions

This might seem like a weird question, but bear with me. I'd like to
Hi this may seem like a weird question, but here's my situation: I have
Sounds like a weird question, but say I have something like this: $.post( /myajax.php,
Weird question, but I have a dictionary created with StringComparer.OrdinalIgnoreCase, looks something like this
this may be a weird question but I have several radio button groups with
Following this question: Weird MIPS assembler behavior with jump (and link) instruction I have
I know this is a weird question to ask, but I would like to
OK, this is a slightly weird question. We have a touch-screen application (i.e., no
This is a weird question inasmuch as I've definitely had projects that work fine,
This might be a weird question, but I'll try anyway. I set up my

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.