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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:33:38+00:00 2026-06-02T04:33:38+00:00

I am trying to validate a string in a ‘iterative way’ and all my

  • 0

I am trying to validate a string in a ‘iterative way’ and all my tryouts just fail!
I find it a bit complicated and i’m guessing maybe you could teach me how to do it right.
I assume that most of you will suggest me to use regex patterns but i dont really know how, and in general, how can a regex be defined for infinite “sets”?

The string i want to validate is
“ANYTHING|NUMBER_ONLY,ANYTHING|NUMBER_ONLY…”

for example: “hello|5,word|10” and “hello|5,word|10,” are both valid.

note: I dont mind if the string ends with or without a comma ‘,’.

  • 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-02T04:33:40+00:00Added an answer on June 2, 2026 at 4:33 am

    Kleene star (*) lets you define “infinite sets” in regular expressions. Following pattern should do the trick:

    [^,|]+\|\d+(,[^,|]+\|\d+)*,?
    A----------B--------------C-
    

    Part A matches the first element. Part B matches any following elements (notice the star). Part C is the optional comma at the end.

    WARNING: Remember to escape backslashes in Java string.

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

Sidebar

Related Questions

Im just trying to validate an email ending with a particular string. Im using
I am trying to find a method to validate a string, using a list
I'm trying to validate an e-mail string, and it seems like all public options
I’m trying to validate a string which contains numbers where each four numbers are
I'm trying to write a a regex to validate a string to match the
I'm trying to validate a form using Data Annotation. It seems great for string
I've been trying to validate an inputted string ( sys argv[1] in this case).
I am trying to validate that the given string contains contains only letters, numbers,
I'm trying to validate my JSON API using node.js + json-schema.js from commonjs-utils. Just
im trying to validate a string of text that must be in the following

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.