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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:33:06+00:00 2026-05-28T19:33:06+00:00

i am trying to validate a custom expression. This expression contains the follow conditions:

  • 0

i am trying to validate a custom expression. This expression contains the follow conditions:

  • Number position;
  • Type operation;
  • Expression;
  • Alias (optional);
  • Comment (optional);

The conditions are separated by “|” pipe. So, four pipes is the limit.

So, to be a valid expression:

0|S|write(&var1)|alias1|my coment – OK
0|K|write(&var1)|alias1|my coment – FAIL
1|I|read(&var2)|alias2| – OK
1|S|read(&var1)|| – OK
2|N|if(&var1 == &var2);read(&var3)|| – OK
3|S||| – FAIL
3|I|write(&var1)|alias 3| – FAIL
3|N|write(&var1)|alias1|my coment| – FAIL

I am using this ER to validate:

^(\d{1,10})\|(S|M|I|N)\|(.+?)\|([a-zA-Z0-9]+)?\|(.+)?

But i can not validate the expression that ends with pipe. Because, in a comment can have any caracter except a pipe…

Some idea??

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-28T19:33:07+00:00Added an answer on May 28, 2026 at 7:33 pm

    Try using [^|] instead of (.+)? at the end of your regex:

    ^(\d{1,10})\|(S|M|I|N)\|[^|]+\|([a-zA-Z0-9]*)\|([^|]*)$
    

    As a side note: for every sub-expression subexpr the following regexes are equivalent:

    ((subexpr)+)?
    

    and

    (subexpr)*
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a custom RegularExpressionValidator to validate the current expression number(0-99).number(100-1000)\number(0-99).number(100-1000)
I was trying to validate an XML signature. The validation according to this tutorial
I am trying to validate a form in MVC. I add custom errors to
I am trying to validate a phone number which is contained over two fields.
I'm trying to write a custom method to validate a date. The date however
I'm trying to use form_validation to validate a domain name using a custom run:
So I have this form on a page and trying to validate values with
I'm trying to create a method that will custom validate any TextBox control passed
I'm trying to validate that my custom Java object is serialized/de-serialized properly, and I
I'm ultimately trying to validate a FileField by extension type. But I'm having trouble

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.