
write a regular expression for Assume we start indexing at 1, so that xl|x is the...
Using Regular Expression. 1. Write the regular expression that matches any string that ends with a capital letter. 2. Write the regular expression that matches any string that begins with a digit, ends with a digit, and has AT MOST only one digit in the middle of the string. (* means zero or more of preceding, +means one or more and ? means 0 or 1 (we did not look at the ? in class)) So your answer should match...
5. In the process of transforming the following NFA to a regular expression, start- we first connect a new start state s to the start state of the given NFA and connect each final state of the given NFA to a new final state f as shown below. If we eliminate state O first, the modified NFA becomes of the following form. Fill out the three blanks in the following figure. (6 points) If we eliminate state 1 and state...
Write a context-free grammar that generates the same language as regular expression which is ab*|c+ (Describe the four components of context-free grammar which are start symbol(S), non-terminals(NT), terminals(T), and set of production rules(P))
Find a regular expression for all entries in which their first and last names both start with the letter J.
8.17 python a.) Write a regular expression pattern to match all words ending in s. b.) Write a regular expression pattern to match all words ending in ing. c.) Write a regular expression pattern to match all words with ss anywhere in the string. d.) Write a regular expression pattern to match all words beginning and ending with the letter a. e.) Write a regular expression pattern to match all the words that start with st. f.) Write a regular...
roblem 18 [15 points Consider the Turing M (Q,E, T,6,4, F), such that 16 g transition set (d) Write a regular expresion that defitves L. fsuch a regular expression does mot exist, prove it Answer: E, N,t,1, R (M has an one-way infinite tape (infinite to the right only.) B is the designated blank symbol. M accepts by final state.) Let L be the set of strings which M accepts Let LR be the set of strings which M rejects....
Write a regular expression for fixed-point, floating point numbers. Assume that there is always at least on digit on either side of the decimal point. For example, 0.12, 5.0. Use character classes as explained above.
Write a regular expression pattern that matches familial relationships involving a mother, father, son, daughter, and the words Great, grand, and Step. To simplify the problem, we will use just the first letters (case is important) of these words with no spaces between them. The symbol GGgs means great great grandson. Legal: Should Match : m, gf, Ggm, GGgf, Ss,, SGgs, Illegal: Should Not Match: mf, Gm, SSm, GSm,
(1) Write a regular expression for the language. (2) Define a finite state machine (FSM) that recognizes words in the language (input alphabet, states, start state, state transition table, and accept states). Include a state digraph for the FSM. A: For alphabet {p,q,r}, all strings that contain the substring rqr or end with pp.
The alphabet for generating DNA sequences is {A, T, G, C}. Write a regular expression that represents all DNA strings that begin with ‘A’ and end with ‘A’. Note: assume empty string is not a valid string. Design a deterministic finite automaton to recognize the regular expression.