Question

UNIX and Shell Programming. Given the regular expression, circle all the matching patterns. Probl...

UNIX and Shell Programming.

Given the regular expression, circle all the matching patterns.

Problem 1. \..\{3\}$

a. rs.ef$tt

b. abc.ab

c. abc.$$$$

d. abc

e. none

Problem 2: :?.?

a. :a?????????

b. eeeeeefffff?hhhh

c. aaa::??????

d. :?.\?

e. none

Problem 3.   Write a regular expression that matches a nonblank line.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find the following match for regular expressions.

Problem 1. \..\{3\}$

The above regular expression matches pattern ends with "." and any same character occurrence of three.

Answer: none

//its not matching any of the patterns

USER> grep '\..\{3\}$' reg1

Problem 2: :?.?

The above regular expression matches a pattern with":<any character><any character><any character>"

Answer: aaa::??????

USER> grep ':?.?' reg2
aaa::??????

Program 3:

This regular expression -e '^[[:space:]]*$' matches only blank line or  lines with spaces/tabs, if we add "-v' to grep then, it will display only the non blank lines


USER> cat reg2
:a?????????
eeeeeefffff?hhhh

aaa::??????

:?.\?


USER> grep -v -e '^[[:space:]]*$' reg2
:a?????????
eeeeeefffff?hhhh
aaa::??????
:?.\?

Add a comment
Know the answer?
Add Answer to:
UNIX and Shell Programming. Given the regular expression, circle all the matching patterns. Probl...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Given the regular expression: ^[ABC][^AB]$ find all the matching patterns (could be more than one): a)...

    Given the regular expression: ^[ABC][^AB]$ find all the matching patterns (could be more than one): a) A b) AB c) ADBC d) D e) None

  • Implement a deterministic finite automata (DFA) using C++ programming language to extract matchin...

    Implement a deterministic finite automata (DFA) using C++ programming language to extract matching patterns from a given input DNA sequence string. Design a deterministic finite automata to recognize the regular expression A(A+T+G+C)*A + T(A+T+G+C)*T over the alphaber {A,T,G,C}. This regular expression recognize any string that starts and ends with ‘A’ or starts and ends with ‘T’. Write a program which asks the user to input a DNA sequence. The program should be able to extract all the patterns (substrings present...

  • 1) Write a single line UNIX command to list all sh files matching the multiple conditions...

    1) Write a single line UNIX command to list all sh files matching the multiple conditions below: • at directory "/home/test" • filename containing "exam" 2) Write a single line UNIX command to check if "/home/exam2" in the PATH variable. 3) How to obtain the value of command line arguments in a shell program? 4) Write a single line UNIX command to run an executable Java program Hello at background and output the number of lines in the result. 5)...

  • Could I get these answered and explained to me? I'm new to system level programming and...

    Could I get these answered and explained to me? I'm new to system level programming and rather lost on how to answer or think through these. I'll definitely provide a thumbs up to those who can give an explanation along with their answer. Thanks a bunch! match(es) for expression (maybe each given basic/extended multiple Choose 1. regular no correct match, if no correct option is given then write none as your anser 3), matches or correct and describe the of...

  • Write a regular expression that matches: a) all strings that end with a dot character ".",...

    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...

  • In this assignment, you will implement a deterministic finite automata (DFA) using C++ programming language to...

    In this assignment, you will implement a deterministic finite automata (DFA) using C++ programming language to extract all matching patterns (substrings) from a given input DNA sequence string. The alphabet for generating DNA sequences is {A, T, G, C}. Write a regular expression that represents all DNA strings that contains at least two ‘A’s. Note: assume empty string is not a valid string. Design a deterministic finite automaton to recognize the regular expression. Write a program which asks the user...

  • Part II: Regular Expression 1. Chose match(es) for each given basic/extended regular expression (maybe multiple correct...

    Part II: Regular Expression 1. Chose match(es) for each given basic/extended regular expression (maybe multiple correct matches) and describe the pattern of matched string for 3), 4), 5),6), 11) e.g. (ab+a, (extended regex ) a) ababa b) aba c)abba d)aabba e)aa Answer: b,c; Pattern : The matched string should begin and end with 'a and ‘b' occurs at least once between leading and ending ‘a') ote: 1) to 5)are basic regexes 1) 'a[ab]*a' (a)ababa (b) aaba (c) aabab (d) aabbaa...

  • 3. Given the regular expression (a[b)a(a[b)*. [5 marks] (a) Draw the corresponding NFA diagram using the...

    3. Given the regular expression (a[b)a(a[b)*. [5 marks] (a) Draw the corresponding NFA diagram using the Thompson construction; (b) Transform the NFA to DFA using subset construction. You need to write the derivation process and draw the resulting diagram; [4 marks] [5 marks (c) Express the RE using a CFG 3. Given the regular expression (a[b)a(a[b)*. [5 marks] (a) Draw the corresponding NFA diagram using the Thompson construction; (b) Transform the NFA to DFA using subset construction. You need to...

  • Regular expressions, DFA, NFA, grammars, languages Regular Languages 4 4 1. Write English descriptions for the...

    Regular expressions, DFA, NFA, grammars, languages Regular Languages 4 4 1. Write English descriptions for the languages generated by the following regular expressions: (a) (01... 9|A|B|C|D|E|F)+(2X) (b) (ab)*(a|ble) 2. Write regular expressions for each of the following. (a) All strings of lowercase letters that begin and end in a. (b) All strings of digits that contain no leading zeros. (c) All strings of digits that represent even numbers. (d) Strings over the alphabet {a,b,c} with an even number of a's....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT