“Sara has 3books, and she loves her 2cats. She finds them cute and adorable.
”
Write the regular expression to get the set of all alphabetic strings. (Sara has books
and she loves her cats She finds them cute and adorable)
“Sara has 3books, and she loves her 2cats. She finds them cute and adorable.
”
Write the regular expression to get the set of all words starting with a number.
(3books 2cats)
Choice (b) is Incorrect.
would match punctuation too
Choice (c) is Incorrect.
would only match the number and first letter after
“Sara has 3books, and she loves her 2cats. She finds them cute and adorable.
”
Write the regular expression to get the set of all alphabetic strings excluding words
that start with a number. (Sara has and she loves her She finds them cute
and adorable)
“Sara has 3books, and she loves her 2cats. She finds them cute and adorable.
”
Write the regular expression to get the set of all lowercase strings including only
words that end with e.
“Chanel is not pronounced channel. 3 channels are we had back when cars were
cheaper”
Write the regular expression to get only “Chanel”, “channel” and “channels” ignoring
case of these words (only in this sentence as context)
Choice (a) is Incorrect.
this would also match words like archangel
Assume we are attempting to find the most common letter that words start with
what regex expression would we use to preprocess the data?
Choice (a) is Correct!
this really
won’t in python but trust it works elsewhere :)
Choice (b) is Incorrect.
this will get numbers too!
Choice (c) is Incorrect.
this won’t match any letters!
Choice (d) is Incorrect.
this can grab symbols
Using the expression
[tT]he to match all instances of the word the would yield:
When negating within a regex, the caret is placed outside the square brackets.
The consequent effect of minimising false positives.
There is at least one mistake.For example, choice (a) should be
True.
There is at least one mistake.For example, choice (b) should be
False.
There is at least one mistake.For example, choice (c) should be
True.
There is at least one mistake.For example, choice (d) should be
False.
There is at least one mistake.For example, choice (e) should be
False.
There is at least one mistake.For example, choice (f) should be
False.
Correct!
- True
- False
- True
- False
- False
- False
”Dial 199, for a bumpin’ gud time”, What would be the suitable expression to
capture the hotline?
(Ignoring boundaries and spaces)
Choice (a) is Incorrect.
this matches each number ALONE
Choice (c) is Incorrect.
what kind of
hotline is one number?
Say we have a list of local IP addresses, and we wanna extract them from any given
text containing them.
Given that ip addresses are within the range
192.162.1.0-255 (Choose the most
correct)
Choice (c) is Correct!
Yes I know, this is too
convulted but now you know how much regex sucks
Choice (d) is Incorrect.
You forgot a
dot there at the end lul.