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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:31:01+00:00 2026-06-01T03:31:01+00:00

Ok so I have a phrase delimited by spaces. Each element can only be

  • 0

Ok so I have a phrase delimited by spaces. Each element can only be an integer or real number, with the exception of the last two elements that can be the string null. My regular expression is

([0-9]*\.[0-9]*|[0-9]*) ([0-9]*\.[0-9]*|[0-9]*) ([0-9]*\.[0-9]*|[0-9]*) ([0-9]*\.[0-9]*|[0-9]*|null) ([0-9]*\.[0-9]*|[0-9]*|null)

I do not understand why in the phrase

123 15 3 null null

The last null doesn’t get captured. Someone mentioned the use of ‘/’ and told me they were like quotes for regular expressions, but it seemed to me that adding that just must by regular expression search for that string. I am writing my regular expression in this form because I am implementing it into java and need to separate the groups or elements accordingly.

EDIT:
Thank you everyone for the great responses. Clearly I need more practice, and probably some sleep! My regular expression looks much cleaner now.

Revised Expression

(\d+\.\d+|\d+) (\d+\.\d+|\d+) (\d+\.\d+|\d+) (\d+\.\d+|\d+|null) (\d+\.\d+|\d+|null)
  • 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-01T03:31:02+00:00Added an answer on June 1, 2026 at 3:31 am

    It’s due to the way you’re defining your or groups with the * modifier:

     ([0-9]*\.[0-9]*|[0-9]*|null)
    

    With the above statement, it’s possible to match nothing with [0-9]*. And it will match that first if it can.

    When you have 2 in a row:

    ([0-9]*\.[0-9]*|[0-9]*|null) ([0-9]*\.[0-9]*|[0-9]*|null)
    

    It’s now forced to match the ‘null’ in the first group, but can get away with matching nothing in the second.

    If you were to modify these capture groups to:

    ([0-9]*\.[0-9]*|[0-9]+|null)
    

    They wouldn’t be able to match ‘nothing’ anymore, and would line up the way you want it to.

    You could also flip it around, and force it to match to ‘null’ before nothing:

    ([0-9]*\.[0-9]*|null|[0-9]*)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string of text chunked into phrases, with each phrase surrounded by
I have a file with one phrase/terms each line which i read to perl
I have a query that tokenizes a phrase on spaces and needs to look
I have two custom objects, Phrase Book and Phrase, the Phrase Book has an
In itext I have a chunk/phrase/paragraph (I dont mind which) and I want to
I have stumbled in this phrase in the web: C# is probably not the
I have a javascript that displays a generated text into a div: document.getElementById('phrase').innerHTML =
I don't know if I have all the information needed to phrase this question
I wasn't even sure how to phrase this so you'll have to forgive me
This question is hard to phrase, so I'm going to have to use some

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.