Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment has three parts. Part 1- Regular Expressions (8 points) Our textbook discusses regular expressions in Chapter 2. However, the discussion is brief and

image text in transcribed

This assignment has three parts. Part 1- Regular Expressions (8 points) Our textbook discusses regular expressions in Chapter 2. However, the discussion is brief and it does not give you much information about them. Here is an article that discusses regular expressions in more details: https://www.oreilly.com/ideas/an-introduction-to-regular-expressions Read this article and then write regular expressions for the following items1. Note that your regular expressions must be as compact as possible2 You are only allowed to use the following regular expression constructs in your answers: (a) Quantifiers: *, +,?, and. (b) Character classes: [... (c) Grouping: Note that alternation( are NOT allowed in these questions. 1. (2 points) Phone numbers in USA. The phone numbers in USA is a series of ten (10) digits (0- 9). The digits are divided into three (3) groups separated by two (2) dash characters. There are some other commonly used formats, but we focus on this format only.) The first two groups have three digits each while the last group has four digits. For example, the main phone number for FSU is "910-672-1111 (2 points) The price for a non-expensive3 item. The price should start with a dollar sign (S), followed by a dollar amount (0-99) that consist one (1) to two (2) digits. The dollar amount should not start with a leading zero (0), except for when the dollar amount is zero (0). The dollar amount is then followed by a decimal point(.), and then followed by two (2) digits 2. Your answer should be a single expression for each For example, " [0-9)" instead of "O I 1 I 2 I 3 I 4 I 5 I 6 I 7 I 8 I 9"; "[0-91(2)" instead of " [ C-9] [0-9] ", and "colou?rinstead of "colorIcolour" or "colou10,1)r By non-expensive, we mean that the price is between $0.00 to $99.99, inclusive. Spring 2019 CSC322 Assignment 1 s Fayetteville State University Albert Chan AYETTEVILLE UNIVERSITY Programming Languages representing the cent amount. The cent amount should always have two (2) digits, with a leading or trailing zero if necessary. For example: "$23.06", "$7.00, "$0.50", and "$0.00.4 3. (2 points) Course numbers for FSU. The system of course numbers used in FSU always starts with three (3) or four (4) uppercase letters (A-Z), followed by a three-digit number (100- 999), and followed by another optional uppercase letter as suffix. For example, the course number for this course is "CSC322" (it has no suffix). 4. (2 points) Email addresses for FSU. FSU has two types of email addresses: email addresses for faculty/staff and email addresses for students/alumni. Both types of email addresses are in the form of user@domain. The domain for faculty/staff is "uncfsu.edu" while domain for student/alumni is "broncos.uncfsu.edu". The user part is a string of or more lowercase letters (a-z) followed by zero or more digits (0-9). For exampl email address is "achaneuncfsu.edu", and the email address for a student or alu named Jane Smith can be "janesmith12345@broncos.uncfsu.edu" (this is n real email address). Your regular expression must be able to recognize both type of addresses

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions