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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:45:27+00:00 2026-05-14T22:45:27+00:00

I have the following regex: (?<=\.\d+?)0+(?=\D|$) I’m running it against a string which contains

  • 0

I have the following regex: (?<=\.\d+?)0+(?=\D|$) I’m running it against a string which contains the following: SVC~NU^0270~313.3~329.18~~10~~6.00:

When it runs, it matches the 6.00 (correctly) which my logic then trims by one zero to turn into 6.0. The regex then runs again (or should) but fails to pick up the 6.0.

I’m by no means an expert on Regex, but my understanding of my expression is that it’s looking for a decimal with 1 or more optional (so, really zero or more) digits prior to one or more zeros which are then followed by any non-digit character or the line break. Assuming that interpretation is correct, I can’t see why it wouldn’t match on the second pass. For that matter, I’m not sure why my Regex.Replace isn’t matching the full 6.00 on the first pass and removing both of the trailing zeros…

Any suggestions?

  • 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-14T22:45:27+00:00Added an answer on May 14, 2026 at 10:45 pm

    +? means “match one or more, non-greedy”. You presumably think that it means the same as *, i.e. match zero or more times. So the preceding expression \d must match at least once for your whole expression to match, and that’s no longer the case for the input 6.0.

    Change +? to * and the expression should work.

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

Sidebar

Related Questions

I have the following string, which matches the following RegEx string. I would like
I have the following regex: String regExpression = ^[a-zA-Z0-9+,. '-]{1,+maxCharacters+}$; which works fine for
i have the following regex: private string tokenRegEx = @\[%RC:(\w+)%\].*?; which is when i
I have following regex (abc|def)( ?(\\d+|(?:(?!\\1)[a-z])+)?)* with matches perfectly the subject abc123 456 .
I might have pretty basic question about regex. I have the following regex, which
Simple regex question. I have a string on the following format: this is a
I have the following RegEx: /[a-zA-Z\d ']{1,30}/ and the following string: some text'&& Now,
I have the following regex: a?\W*?b and I have a string ,.! ,b When
I have the following regex type in my xsd file: <xsd:simpleType name="Host"> <xsd:restriction base="xsd:string">
I have the following regex expression on a dev machine that is running .NET

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.