6. A file named randomstrings.txt can be downloaded from the \'Assignments\' pan
ID: 3737796 • Letter: 6
Question
6. A file named randomstrings.txt can be downloaded from the 'Assignments' panel on the DMTH237 iLearn site. It contains 100 binary strings, each of length 100 characters. For each of the regular expressions given below, find the line-numbers of all the strings in that file which match the given regular expression, perhaps in more than one way. You may use whatever software you choose to answer this question; e.g., it can be done using the Find panel of most text-processing software applications, though other specialised utilities may prove to be easier to use, but may first require you to learn how to adapt to the specific language employed to denote a regular expression. You should describe briefly what software you have used, and how you have used it to determine the required line-numbers. Include a screenshot, or other graphic, to help the markers understand what you did to get your answers. (a) Find matches to: (0)* 0000000000 (0 +1)*. (b) Find matches to: (0+1)* (00000000+1111111)111 (0+1) Here a numerical exponent (···)" means "k consecutive matches to the .. , ".Explanation / Answer
Solution:
I am providing you the input strings which will be generated from the given regular expressions, you haven't shared the txt file here.
You can match from the generated input string which I am providing here.
a)
0000000000, 00000000000, 00000000001, 10000000000, 000000000000, 0010000000000110, 010100000000001010, ...
basically, the generated string will contain 10 0's in the string., rest can be any combination of o's and 1's .
b)
00000000111, 1111111111, 000000000111, 100000000111, 000000001111, 000000001110, 11111111110, 01111111111, 11111111111, 11111111110010, ....
The generated string will have either 8 0's or 7 1's and after that 3 1's is a must, rest can be any combination of 0's and 1's
c)
11111101010100110100000,
Here the input string will be some combinations of 0's and 1's and after that 6 consecutive 1's than any combination of 12 0's and 1's then 5 0's and then any combination of 0's and 1's.
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.