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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:32:49+00:00 2026-06-01T02:32:49+00:00

I would like to validate the DNF (Disjunctive normal form) which looks like this

  • 0

I would like to validate the DNF (Disjunctive normal form) which looks like this A*B+A'*C+C*D*E'. For this purpose, I use the folloing following pattern:

/[A-Z]'?(\*[A-Z]'?)*(\+[A-Z]'?(\*[A-Z]'?)*)+/g

I have tested this pattern using javascript test() method in this online tool:
http://www.pagecolumn.com/tool/regtest.htm and it gives me the result I have expected.

I tried to test the pattern with javascript, using the following code:

  <script type="text/javascript">
    var dnf="A*3+A*B+CD";
    var pattern= /[A-Z]'?(\*[A-Z]'?)*(\+[A-Z]'?(\*[A-Z]'?)*)+/g;
    var flag = false;
    flag=pattern.test(dnf);
    console.log(flag);
  </script>

The problem is, I don’t understand, why flag (in this code) become “true”, which has to be “false” cause the terms A*3 and CD in the dnf="A*3+A*B+CD".

I have testet this in the online tester and it says: no matches, what I think is right.

  • 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-01T02:32:50+00:00Added an answer on June 1, 2026 at 2:32 am

    I think you must have entered this into the online tester incorrectly, because I tried the same thing and it is matching "A*B+C" from the string "A*3+A*B+CD":

    enter image description here

    If you only want to match if the entire string matches your pattern, add start and end of string anchors:

    /^[A-Z]'?(\*[A-Z]'?)*(\+[A-Z]'?(\*[A-Z]'?)*)+$/g
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am receiving this XML file which I would like to validate. Ideally I
I would like to validate an email using the RegexValidator, e.g. [RegexValidator(@^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$)] Which works
I have some MET data I want to validate which would look something like
I have a simple form that I would like to validate on form submission.
I would like to validate attributes in a function like this class User <
I have a string that I would like to validate a certain pattern for:
I'm using jQueryValidation and I would like to validate my form without needing to
I would like to validate the format of a form value, allowing an empty
I would like to validate that customer_price >= my_price . I tried the following:
I'm writing a form validation script and would like to validate a given field

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.