Question

In: Computer Science

Write a regular expressions that would match lines in text that contain word DATE: at the...

  1. Write a regular expressions that would match lines in text that contain word DATE: at the beginning of a line followed by actual date in format YYYY-MM-DD. Space between colon ( : ) and date may or may not exist.
  2. In C, if you issue the following statement n << 2 where n is an integer, what will be value of n?
  3. In bash, if you define variable var = “date” and issue a statement echo `$var`, what output will you get?
  4. In bash script, if you issue command read a b c d and enter 1 22 3 44 5 66 7 88, what variables a, b, c, and d contain?
  5. If you want to redirect output of a bash command into a file what operator will you use?
  6. What does operator | mean in bash?
  7. What variable $0 contains in gawk?
  8. What variable $0 contains in bash script?
  9. What the statement esac means in bash script?
  10. If you would define a rule for creating a variable in C using regular expression, how would you write it?
  11. If you need to skip statements in for or while loops and go to the next iteration, what statement will you use?
  12. In respect to users and processes, how would you define Linux OS?
  13. What the following regular expression means (\*|~){1,} ?
  14. You friend notifies you that feature1 branch you are working on currently is updated on a GitLab server. What git command will you use to bring the updates to your local environment?
  15. You want to replace all words people with students in file Lecture1. What sed command will you use?

Solutions

Expert Solution

For no space between colon (:) you can use \b(DATE)\b:\d{4}-\d{2}-\d{2} .If there is space between colon(:) simply put \s for space, therefore it becomes \b(DATE)\b\s:\s\d{4}-\d{2}-\d{2} .

You can use the table below to further modify your expression/pattern.

THUMBS UP IF YOU LIKE IT !


Related Solutions

Write a regular expressions that would match lines in text that contain word DATE: at the...
Write a regular expressions that would match lines in text that contain word DATE: at the beginning of a line followed by actual date in format YYYY-MM-DD. Space between colon ( : ) and date may or may not exist. In C, if you issue the following statement n << 2 where n is an integer, what will be value of n?
Define a regular expression that will correctly (and exactly) match a valid Gregorian calendar date of...
Define a regular expression that will correctly (and exactly) match a valid Gregorian calendar date of the form MM/DD/YYYY (with leading zeroes for single-digit months and days) (and ONLY dates in this format). • Months 1, 3, 5, 7, 8, 10, and 12 have 1–31 days • Months 4, 6, 9, and 11 have 1–30 days • Month 2 (February) has 1–28 days (ignore leap years) • Assume that the year falls into the range 1900–2099 HINT: You may find...
Regular Expressions Assignment Write a regular expression for each of the following. Can you show output...
Regular Expressions Assignment Write a regular expression for each of the following. Can you show output please. A blank line (may contain spaces) Postal abbreviation (2 letters) for State followed by a space and then the 5-digit zip code A KU student username (Ex. lpork247) A “valid” email address (also explain how you defined “valid”) A SSN pattern (ddd-dd-dddd)
QUESTION: Write regular expressions after the ► to validate the following inputs: a) Product codes that...
QUESTION: Write regular expressions after the ► to validate the following inputs: a) Product codes that have one or more letters followed by one or more digits. ► b) Nonnegative integers between 1,000 and 9,999, including the comma. ► c) Canadian zip code containing upper case characters only. ► d) License plate numbers that have the form:          Letter          Digit          Letter          Hypen (-)          Digit          Letter          Digit ►
Write a program to convert a text-file containing expressions (one per line) into post-fix expressions outputted...
Write a program to convert a text-file containing expressions (one per line) into post-fix expressions outputted to a file of your choice using a stack with one space between operators and variables (one letter variables) and/or constants (one digit constants). IN PYTHON please
Write a program to convert a text-file containing expressions (one per line) into post-fix expressions outputted...
Write a program to convert a text-file containing expressions (one per line) into post-fix expressions outputted to a file of your choice using a stack with one space between operators and variables ( one letter variables) and/or constants (one digit constants).
The user is going to cin a whole bunch of regular text. You store each word...
The user is going to cin a whole bunch of regular text. You store each word based on its first letter. Print out all the words they used by letter. Strip all punctuation and uncapitalize everything. : - Project set up with stl includes, correct files, and turned in correctly. (Zipped project with no inner debug folder.) - Basic data structure made. This requires at least two connected containers. More is okay if it makes sense to you, but no...
Question d) Write the regular expression statement that will match a string that starts with the...
Question d) Write the regular expression statement that will match a string that starts with the word "Warning" following by one space and then a number of any number of digits. Question e) Write the regular expression statement that will match a string that ends with the phrase "End of Report. Question f) Write the regular expression statement that will match a string that starts with the phrase "Begin Log:" then contains a collection of characters (other than newline) followed...
Write regular expressions that describes the following language: The language over {0,1,/} that contains all and...
Write regular expressions that describes the following language: The language over {0,1,/} that contains all and only the strings that are base-2 (as above, you can use base-10 if you prefer) representations of rational numbers. Define a representation of a rational number to be either a representation of an integer, or two representations of integers separated by “/”. Leading 0s are allowed this time.
Write regular expressions that describes the following language: The language over {0,1} that contains all and...
Write regular expressions that describes the following language: The language over {0,1} that contains all and only the strings that are base-2 representations of odd positive integers. Do not allow leading 0s. (If you are more comfortable writing bulky regular expressions than you are working in base-2, you may write a regular expression for strings that are base-10 representations of odd integers without leading 0s, using alphabet {0,1,2,3,4,5,6,7,8,9}.)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT