write a regular expression in python (nltk) that will find strings using integers, additon, and multiplication, such as 5*5+8.
Regular expression:-
(\d+(*|/|+|-))+
Explanation:-
The above regular expression is used to perform one or more operations between the digits.
\d indicates the digit from 0-9 which is followed by the + .It means that the size of the number obtained by the digits from 0-9 can be 1 or more than 1.
(*|/|+|-) indicates the four arithmetic operations i.e, multiplication , division , addition , subtraction. It contain | symbol indicating the OR operation which mean that either of the 4 operations is chosen at a time.
+ (at the end) clearly indicates that one or more operations between one or more digits.
write a regular expression in python (nltk) that will find strings using integers, additon, and multiplication,...
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 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...
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...
Multiplication of two numbers: Write a recursive program that multiplies two integers. As an input to your program perform multiplication of the largest 8-bit number (unsigned) with the largest 16-bit number (unsigned) [Programming, 10 Points]. Complete in python and show output
•Write a regular expression for both a zip code and a phone number in python.
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.
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...
Find a regular expression for the following language over the alphabet Σ = {a,b}. L = {strings that begin and end with a and contain bb}.
Use the Python “re” module to do the following: 1. Write a regular expression pattern that matches string “March 1, 2019, Mar 1, 2019, March First, 2019, March First, 19”. No credit for not using special characters: “*,+,?, | and etc” to do the matching. 2. Write a regular expression pattern that matches strings representing trains. A single letter stands for each kind of car in a train: Engine, Caboose, Boxcar, Passenger car, and Dining car. There are four rules...
Find all strings with length exactly 4 represented by the regular expression, a*bb*. Put your answers in alphabetical order separated by a single space and no commas.