Shell Components   «Prev  Next»

Regular Expressions in Unix - Quiz

Understanding Regular Expressions


Select the best answer or answers for each question.
 
1. Choose a pattern to find all dollar values from $10.00 to $99.99.
Please select the best answer.
  A. \$[1-9][0-9]\.[0-9][0-9]
  B. $[1-9][0-9].[0-9][0-9]
  C. \$[1-9]*[0-9]
  D. $[1-9][0-9]\.[0-9].

2. Which of the following will the pattern [Aa].[Tt] include?
Please select all the correct answers.
  A. AST
  B. acting
  C. batch
  D. Astrabad

3. Which of the following will the pattern [Aa]*[tT]. include?
Please select all the correct answers.
  A. batch
  B. Astrakhan
  C. rabbit
  D. atlas

4. Choose the pattern that will find FarAway at the beginning of a line:
Please select the best answer.
  A. ^FarAway
  B. \^FarAway
  C. ^[FarAway]
  D. [0]FarAway

5. Choose the pattern that finds all filenames in which
  1. the first letters of the filename are chap,
  2. followed by two digits,
  3. followed by some additional text,
  4. and ending with a file extension of .doc
For example :
chap23Production.doc
Please select the best answer.
  A. chap[0-9]*.doc
  B. chap*[0-9]doc
  C. chap[0-9][0-9].*\.doc
  D. chap*doc



Linux Shell Scripting