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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:26:15+00:00 2026-06-08T08:26:15+00:00

Learning regex but this one gives me a headache. I need to match a

  • 0

Learning regex but this one gives me a headache. I need to match a float number (with either . or , as decimal point) and it MUST end with the following characters: €/g.

Valid matches should be for example:

  • 40€/g
  • 43.33€/g
  • 40,2€/g
  • 40.2€/g
  • 38.943€/g

Appreciate help..

  • 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-08T08:26:17+00:00Added an answer on June 8, 2026 at 8:26 am

    The regex will look like:

    \d+(?:[.,]\d+)?€/g
    

    In Javascript, as a regex object (note that the forward slash needs to be escaped):

    /\d+(?:[.,]\d+)?€\/g/
    

    Here’s a breakdown of what each part does:

    \d+  # one or more digits
    (?:    # ... don't capture this group separately
     [.,] # decimal point
     \d+  # one or more digits
    )?   # make the group optional
    €/g  # fixed string to match
    

    If you want to allow something like .123€/g to be valid as well, you can use:

    (?=[.,]|\d)(?:\d+)?(?:[.,]\d+)?€/g
    

    That is, both the groups of digits are optional, but at least one must be present (this uses lookahead, which is a bit more tricky).

    Note that this will also match constructions like ‘word2€/g’. If you want to prevent this, start the regex with (?<=^|\s) (matches if preceded by a space or the start of the string) and end it with (?=$|\s) (matches if followed by a space or the end of the string).

    Full-blown version:

    (?<=^|\s)(?=[.,]|\d)(?:\d+)?(?:[.,]\d+)?€/g(?=$|\s)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently learning regex but need this quite urgently. I have a set
This seems to match the rules I have defined, but I only starting learning
I've started learning regex but this has so many elements in it. What does
Good afternoon, I'm learning about using RegEx's in Ruby, and have hit a point
I am stumped by this one. I am just learning regular expressions and cannot
I asked a question similar to this one a couple of weeks ago, but
I am not very good with Regex but I am learning. I would like
I'm learning/practicing Regex. I've written this to test for url's...I want it to catch
I'm learning regex, and I can't understand the grouping in Java. Currently my regex
Im just learning mod_rewrite and regex stuff, and what I'm trying to do is

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.