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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:00:24+00:00 2026-05-12T21:00:24+00:00

I have never dealt with regular expressions before, and I am facing a problem

  • 0

I have never dealt with regular expressions before, and I am facing a problem here. The user has to input a text like Var1(0,enum1,enum2), and I have to check the syntax on the following manner:-

1- make sure Var1 name matches the list of variables I have.. Just a string comparison

2- make sure the parameters are input in sequence.

3- dropping any parameter is allowed. and also no parameter at all is allowed

then I have to take the parameters to fill up some object

will regex do the trick for me, or I have to go for writing a parser !?

Thanks!

  • 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-12T21:00:25+00:00Added an answer on May 12, 2026 at 9:00 pm

    I wouldn’t do this with a regular expression, but here’s one that does what you want (I am using general regexp syntax – nothing C# specific).

    Assuming that the variables are var1, var2, var_3, and the the options for paramater 1 are par1_1, par1_2 and the options for parameter 2 are par2_1, par2_2, par2_3, etc then the regular expression is:

    (var_1|var_2|var_3)\(((par1_1|par1_2|par1_3),)?((par2_1|par2_2,)?((par3_1|par3_2)?\)
    

    Note that:

    • (a|b|c) chooses one of a, b or c
    • \( and \) match parentheses (plain “(” and “)” group)
    • (…)? is optional
    • There is a comma included after each optional parameter block, except the last.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a use case that I've never really dealt with before. I have
I'm totally familiar in making static and dynamic websites. However, I have never dealt
I have never saved and retrieved an image to and from the database before.
I have never programed in bash before. I am reading all the files that
I have never used Foxpro before. Can you convert the following Foxpro code into
I have never done any Windows coding and I would like to give it
I have never programmed a gadget for Vista or Seven, but I would like
I have never made a blog before. I am proficient with html and css.
Ok just got assigned to a new project and have never dealt with Javascript
Have not worked with ASP in a very long time and have never dealt

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.