In: Computer Science
Unix / Linux
16.
Regular Expression:
Given the following regular expression, provide a description of the intended match.
^[^A-Z]
17.
Regular Expression:
Given the following regular expression, provide a description of the intended match.
[^^!]
18.
Regular Expression:
Given the following regular expression, provide a description of the intended match.
^.\{72\}$
19.
Regular Expression:
Given the following regular expression, provide a description of the intended match.
[A-Za-z0-9]
20.
Regular Expression:
Given the following regular expression, provide a description of the intended match. [There's a single space character inside the first square bracket pair.]
[ ][A-Za-z]\{1,\}$
16. [^ ] means a single character that isn't a part of this group.
Hence, [^ A-Z] means no capital letters should be present.
^[] means this pattern should be included in the beginning of the line.
Hence, ^[^A-Z] means no capital letter should be present in the beginning of the line.
17. [^] means anything except the characters or symbols enclosed.
hence, [^^!] means any character other than ^ or ! is acceptable.
18. ^.\{72\}$ means to group all the lines which are exactly 72 characters wide.
19. [ ] means a single character present within the group.
hence, [A-Za-z0-9] means any character or numeric value is acceptable as a single character.
20. It means if you want to replace these relating character to something else.
It can be manipulated in sed command as
$ sed 's/[][A-za-z]\{1,\}$/replace/'
The alphabets should be replaced by the specified characters. Any combination of a space with an alphabet should be replaced with the specified digits.