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?
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 ►
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...
Write a Java program that will test lines of text to see if they are palindromes....
Write a Java program that will test lines of text to see if they are palindromes. The program should prompt the user for the name of a file to process, then open and read the file of possible palindromes (one per line of text). The program should then print the total number of lines read, and total number of palindromes.
Write a program that allows the user to navigate the lines of text in a file....
Write a program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the program...
Write a program that allows the user to navigate the lines of text in a file....
Write a program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the program...
Write a C++ program to create a text file. Your file should contain the following text:...
Write a C++ program to create a text file. Your file should contain the following text: Batch files are text files created by programmer. The file is written in notepad. Creating a text file and writing to it by using fstream: to write to a file, you need to open thew file as write mode. To do so, include a header filr to your program. Create an object of type fsrteam. Open the file as write mode. Reading from a...
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