Write a Regular Expression, requirements: 1. They contain letters, digits, and p
ID: 3923431 • Letter: W
Question
Write a Regular Expression, requirements:
1. They contain letters, digits, and punctuation symbols
2. They must contain at least a letter and a number, and at least one but at most two punctuation symbols
3. They cannot start with a punctuation symbol
Using exclusively the regular expresssion operators epsilon(empty), * (zero or more copies), and + (concatenation), write a regular expression denoting the set of all passwords that satisfy these requirements. For brevity, use: L, D, and P to denote Letter, Digit, and Punctuation, respectively.
My answer: ( LD ) ( P + PP ) ( L + D )* + ( DL ) ( P + PP ) ( L + D )* ... but I don't think it is correct.
Explanation / Answer
So the required expression can be written as follows:
^[ LDP ]* + [ LD ] [ LDP ]*
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.