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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:20:02+00:00 2026-06-08T18:20:02+00:00

As a preface, I realize there are other topics on regular expressions with comma

  • 0

As a preface, I realize there are other topics on regular expressions with comma separated numbers, but when I tried to use those solutions, they didn’t work.

Basically, I am trying to create a regular expression to recognize comma separated numbers (in this case without spaces). Before trying to convert this into actual regex syntax, I realize that it should probably work something like this, where ‘d’ is a number and ‘,’ is a comma, and ‘+’ is a kleene plus:

((d+),)*(d+)

or

(d+)(,(d+))*

Here’s the code I am using in an Apex validation to make sure that a certain field is a list of numbers separated by commas without spaces (note: I have tried several variations of this to no avail, but will only post one):

(\d+,)*(\d+)

For some reason this isn’t working, but it seems to be the correct syntax of any digit 1 or more times followed by a single comma, and that entire expression can be repeated 0 or more times, and that entire repeated expression should always be followed by at least 1 digit.

This expression in practice does recognize all the accepted forms (ex: 100 or 100,200 etc.), but for some reason it also accepts answers like

'100,200,'

or

'100,200,,'

or

'100,,200'

I’m pretty stumped as to why this won’t work as well as the previously given solutions which seem to do the same thing mine do. Thanks for any help in advance!

  • 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-08T18:20:03+00:00Added an answer on June 8, 2026 at 6:20 pm

    That’s it:

    ^(\d+,)*\d+$
    

    The anchors ^$ will make the difference because they will force the whole string (not just a part) to match the pattern

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

Sidebar

Related Questions

Preface: I am sure this is incredibly simple, but I have searched this site
Preface: I know that there are high quality graph APIs available. I'm interested in
Let me preface this by saying I now realize how stupid I am and
I will preface this by I am new to XNA and I realize what
Preface Please note, I'm not looking for a code solution, but rather insight into
preface note: I'm just starting to learn Grails, so I'm sure there are many
Preface: I'm developing an application that quizzes users on multiple topics. I wish to
To preface, I've seen the command to answer this question before, but now I
To preface, I've been working with C# for a few months, but I'm completely
To preface this, I do not work with Java or Struts, but I understand

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.