Question: Write regular expressions for the following languages using Gos regular expression syntax (using Go to test your answers would be a good idea). Use ^

Write regular expressions for the following languages using Gos regular expression syntax (using Go to test your answers would be a good idea). Use ^ and $ to get exact matches

NOTE 1: the goal of a regular expression is to not only match valid values, but also to *not* match invalid values.

Note 2: however, treat regular expressions as not having a memory of what has been matched so far. This means, for example, that for the Reign in Tenochtitlan question below, if there are two years in the range, you cannot check if the 2nd year is greater than the first year.

California Drivers License number: https://ntsi.com/drivers-license-format/ Links to an external site.has formats for all states

Football results at https://www.49ers.com/schedule/Links to an external site.

The results are on the right side, with a W for win, L for loss, and Im assuming T for tie

The score is a pair of integers separated by a dash

Valid sizes of sewing needles among other places, Sewing Machine Needle Sizes & Types Guide + Printable Chart (sewingmachinefun.com) Links to an external site.explains that the size is listed as

2 numbers separated by a /, European size before the /, American size after the /

The first number is 2 or 3 digits long

The second number is 1 or 2 digits long

Idaho Drivers License number: defined in the NTSI link above. You need to cover both possibilities with one regular expression

The years over which a particular Tenochtitlan ruler reigned see the Reign column of: List of rulers of Tenochtitlan - WikipediaLinks to an external site.

To make this slightly easier, just cover the possibilities in the 2nd section of rulers (the pre-imperial tlatoque)

Also, ignore the part describing the number of years of rule

A line for one quantity on a Nutritional Facts label as described at: How to Understand and Use the Nutrition Facts Label | FDALinks to an external site.The line starts with what is being measured, like Saturated Fat or Vitamin B12

You do not need to cover other cases like the added sugar line

The next thing is the amount, with the amount and the unit of measurement, like 4.5g or 1.6mg

Lastly you have the percentage of the daily recommendation, like 23% or 425% (if you check a vitamin bottle, you get some of these)

A subset of valid chess moves in the algebraic notation: Algebraic notation (chess) - WikipediaLinks to an external site.

Only represents simple moves, captures and the possibility of a check (a piece can attack the opponents king)

The specific parts of the web page you can refer to are:

The introductory paragraph to the Notation for Moves section

The first paragraph of the Captures subsection, but just use x for captures and ignore the : option

The first sentence of the Check subsection so only the part about +

Build on the previous question to represent all moves of an entire chess game.

You are only being graded here on the parts that combine the moves together.

Include the numbers for the moves

Include the final result, described in the End of game subsection. For , use the three characters 1/2

Grading: 10 points for each question, with 20 free points for a valid submission (again, an invalid submission is pretty obvious, like submitting the solution from a previous years assignment, which has unfortunately actually happened)

Submitting: Students will occasionally submit scans of handwritten work. That is acceptable, but only if it is neat and legible, which is dependent on the grader. The format is acceptable to the Go compiler, so even the most basic text editor works here.

Note: I am restricting the file types for uploads to try to make sure the grader can easily open your file, so the options are txt, doc, docx, pdf, png

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!