Write a regular expression for all unsigned numbers. They are strings such as 5280, 39.37, 499E3, 63.36E4, 1.894E-3, 2.3478E+11. You are not allowed to have a naked decimal point. For example the number 5. or .5 is not allowed, must use 5.0 and 0.5. The E is for exponent, essentially scientific notation. Give the transition diagram as well.
The regular expression is given as:
^\d+(\.\d{1,2})?$
\d+(\.\d{1,2})?
It allows all of your cases and nothing else.
Write a regular expression for all unsigned numbers. They are strings such as 5280, 39.37, 499E3,...
Write a regular expression that matches: a) all strings that end with a dot character ".", without the quotes. b) all strings that begin with a "#" character, without the quotes. c) all floating-point numbers using standard notation (e.g., 12.345 or –12.345). Note that matching numbers may contain any number of digits before or after the decimal point. d) all floating-point numbers using scientific notation (e.g., 1.234e+5 or –1.234E–5). Again, matching numbers may contain any number of digits before or...
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 that captures the set of strings composed of 'a', 'b', and 'c', where any string uses at most two of the three letters (for example, "abbab" is a valid string, or "bccbb", or "ccacaa", but not "abccba": strings that contain only one of the three letters are also fine). Give a non-deterministic finite automaton that captures the regular expression from Using the construction described in class, give a deterministic version of the automaton. Repeat the previous...
Regular Expressions Write a regular expression for numeric constants in C. These are octal, decimal, or hexadecimal integers, or decimal or hexadecimal floating-point values. An octal integer begins with 0, and may contain only the digits 0-7. A hexadecimal integer begins with 0x or 0X, and may contain the digits 0-9 and a/A-f/F. A decimal floating-point value has a fractional portion (beginning with a dot) or an exponent (beginning with E or e). Unlike a decimal integer, it is allowed...
regular expression is (00)*11+10. 1into an ?-NFA. Give state transition diagram of the ?-NFA as well as its state transition table showing ?-closure of the states. 2 Convert the ?-NFA to a DFA by the subset construction. Give state transition diagram of the DFA.
Write a regular expression that matches whole numbers, such as 34, and 8, as well as real numbers with two decimal digits, such as 100.99 and 3.56. Your regular expression will not match numbers with one decimal digits, such as 3.4 or more than two decimal digits, such as 3.555. Answer:
write a regular expression in python (nltk) that will find strings using integers, additon, and multiplication, such as 5*5+8.
6. [4 marks] Write a regular expression over the alphabet of numeric digits that matches strings formatted as integers between 33 and 526 (inclusive). For example, the following strings should be accepted: • 33 • 51 • 290 • 526 But the following strings should not be accepted: • 9 • 31 • 607 • 1000
Write a regular expression that matches all numbers between 5-32, (including 5 and 32).
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....