Question

3. Define the regular expression for: (5 points) A valid URL Solution: (5 points) A valid email address Solution: a. b.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Dear Student ,

As per the requirement submitted above , kindly find the below solution.

Regular Expression for valid URL :

http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?

Regular Expression for valid email address :

/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([com\co\.\in])+$/;

or

\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*

Explanation :

  • This expression says enter valid letter from a-z , A-Z and 0 t0 9 before @.
  • After @ enter domain name that contains a-z , A-Z and 0 to 9.
  • Followed with com or ,co or .in.
  • Example : viratkohli@vk.com

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.

Add a comment
Know the answer?
Add Answer to:
3. Define the regular expression for: (5 points) A valid URL Solution: (5 points) A valid...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 1. Use a Regular Expression to define the set of all bit strings of one or...

    1. Use a Regular Expression to define the set of all bit strings of one or more 0's followed by only a 1. 2. Use a Regular Expression to define the set of all bit string of two or more symbols followed by three or more 0's. 3. Are these two grammars the same? a. S-> aSb|ab|λ b. S-> aAb|ab A->aAb|λ 4. Use the process of elimination to find the language of the following FA: (see picture for diagram) 5....

  • 6. (If you cannot get the exact regular expression, put one that is as close as...

    6. (If you cannot get the exact regular expression, put one that is as close as you can. Specify what is wrong with it.)An IP address is often written as four decimal numbers ranging from 0 to 255 with dots between them. For example the database server that we use for this class is 163.238.35.165 a. Write a regular expression that matches IP addresses of this type. You can probably find this answer online, but try to do it yourself...

  • (a) (5 Points) Construct an equivalent NFA for the language L given by the regular expression...

    (a) (5 Points) Construct an equivalent NFA for the language L given by the regular expression ((a Ub) ab)*. Please show the entire construction, step-by-step, to receive full points.

  • Programming Languages Final Exam Name: Question 1 (15 points) Give a regular expression for each of...

    Programming Languages Final Exam Name: Question 1 (15 points) Give a regular expression for each of the following languages over = {0,1,2). 1. All strings that begin with 1 and end with 2. 2. All strings that contain exactly three 1's. For example, "0101012" is valid. 3. All strings in which the digits are non-decreasing. For example, "002" is valid, but "102" is not.

  • Regular expression to DFA Regular expression: [AZ]3*((4?q+)|(6*y))?z+ DFA: ????

    Regular expression to DFA Regular expression: [AZ]3*((4?q+)|(6*y))?z+ DFA: ????

  • 4(10 points] Let A be the language over the alphabet -(a, b) defined by regular expression...

    4(10 points] Let A be the language over the alphabet -(a, b) defined by regular expression (ab Ub)aUb. Give an NFA that recognizes A. Draw an NFA for A here 5.10 points] Convert the following NFA to equivalent DFA a, b 4(10 points] Let A be the language over the alphabet -(a, b) defined by regular expression (ab Ub)aUb. Give an NFA that recognizes A. Draw an NFA for A here 5.10 points] Convert the following NFA to equivalent DFA...

  • C++ Write. Feel free to create a form/GUI or use console to create a regular expression...

    C++ Write. Feel free to create a form/GUI or use console to create a regular expression to determine if a phone number input is valid. You will need to import a regular expression library. My code below as an example.          string phoneNum =txtName.Text;          string MatchPhonePattern = @"\(?\d{3}\)?[. -]? *\d{3}[. -]? *[. -]?\d{4}";       Regex rx = new Regex(MatchPhonePattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);         Match match = rx.Match(phoneNum);         if (match.Success)             lblDisplay.Text = "Valid number";         else             lblDisplay.Text...

  • 3. Given the regular expression (a[b)a(a[b)*. [5 marks] (a) Draw the corresponding NFA diagram using the...

    3. Given the regular expression (a[b)a(a[b)*. [5 marks] (a) Draw the corresponding NFA diagram using the Thompson construction; (b) Transform the NFA to DFA using subset construction. You need to write the derivation process and draw the resulting diagram; [4 marks] [5 marks (c) Express the RE using a CFG 3. Given the regular expression (a[b)a(a[b)*. [5 marks] (a) Draw the corresponding NFA diagram using the Thompson construction; (b) Transform the NFA to DFA using subset construction. You need to...

  • (4 points.) Consider the regular expression (11 + 00)'1(e + 01). . Give two strings of O's and 1's, each 6 to 12 characters long, that are both represented by this regular expression...

    (4 points.) Consider the regular expression (11 + 00)'1(e + 01). . Give two strings of O's and 1's, each 6 to 12 characters long, that are both represented by this regular expression . Construct a nondeterministic finite automaton equivalent to the regular expression. (4 points.) Consider the regular expression (11 + 00)'1(e + 01). . Give two strings of O's and 1's, each 6 to 12 characters long, that are both represented by this regular expression . Construct a...

  • 4.[10 points] Let A be the language over the alphabet E-(a, b} defined by regular expression...

    4.[10 points] Let A be the language over the alphabet E-(a, b} defined by regular expression (ab U b)*a U b. Give an NFA that recognizes A. Draw an NFA for A here. 4.[10 points] Let A be the language over the alphabet E-(a, b} defined by regular expression (ab U b)*a U b. Give an NFA that recognizes A. Draw an NFA for A here.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT