grep and regular expressions.
Remember, regular expressions are greedy. They will match as much as possible.
01. Find any line with a digit in it.
If you find a digit, 0-9, anywhere on the line, it's a match.
02. Find any line with two digits anywhere in it.
Find two digits of any value anywhere on the line. They don't have
to be next to each other. They don't have to be the same digits.
03. Find any line with two digits next to each other.
Find two digits of any value next to each other. They can be different
values.
04. Find any line with the same letter immediately following the 1st.
Look fo the same letter two times in a row. It has to be a letter, a-zA-Z.
But, it can appear anywhere on the line.
05. Find any line with a pair of letters repeated anywhere else on the line.
Look for a pair of letters. The two letters don't have to match each other.
Treat them as a single pair.
06. Find any line with a pair of letters repeated anywhere else in the same word.
Remember the letters as a pair. The repeated pair can only be separated
from the 1st pair by zero or more other word characters.
07. Find any line with a pair of letters repeated immediately after the 1st pair.
Remember the pair of letters. Look for their match immedietely following the 1st pair.
08. Find any line with a pair of letters repeated anywhere else on the line in reverse order.
Rememeber each letter separately. There may be zero or more characters of
any value following the pair, followed by the 2nd letter, followed by teh 1st
letter.
09. Find any line with a pair of letters repeated anywhere else in the same word in reverse order.
Rememeber each letter separately. There may be zero or more word characters following the pair, followed by the 2nd letter, followed by teh 1st letter.
10. Find any line with the same character occurring two more times anywhere on the line.
Look for a character of any value and remember it. Look for the same
character again. There may be zero or more characters of any value inbetween.
11. Find any line with a set of 3 letters repeated next to the 1st three.
Remember a set of any three letters. Then look for the same remembered
triplet immediately following the 1st three.
12. Find any line with three consecutive letters repeated next to the 1st three in reverse.
Separately remember three characters of any letter value that occur in a
row. Now look for the 3rd letter followed by the 2nd letter, followed by the
1st. letter immediately following the original three letters.
13. Find any line with three consecutive letters repeated anywhere else on line, but not next to each other.
Remember a set of any three letters. Then look for the same remembered
triplet separated by the 1st three by any number of any characters of any
value.
14. Find any line with three consecutive letters repeated anywhere else on line in reverse, but not next to each other.
Remember separately three letters in a row. Then look for the same
three letters occuring in reverse order separated by the 1st three by any
number of any characters of any value.
15. Find any line with a capital letter in it.
Just look for a capital letter.
16. Find any line with one and only capital letter in it.
Start search at beginning of the line. Look for any number (0 or more) of
characters that are not a capital letter, followed by one capital letter,
followed by any number (0 or more) of characters that are not a capital
letter all the way to the end of the line.
17. Find any line with two words anywhere on the line starting with a capital letter.
Look for the start of word where the 1st character capitalzied followed by
any number of characters of any kind followed by the start of another word
the 1st character is capitalized.
18. Find any line with two words next to each other starting with a capital letter.
Look for the start of word where the 1st character capitalzied followed by
any number of word characters followed by any number of non-word characters
followed by the start of another word where the 1st character is capitalized.
19. Find any line with two consecutive capital letters.
Look for two capital letters in a row.
20. Find any line with the same letter repeated elsewhere in the same word but not next to itself.
Remember a letter, followed by one or more word characters followed by the
remembered letter.
21. Find any blank lines.
Look for the start of the line immediately followed by the end of the line.
22. Find any line longer than 6 characters.
Look for a line with at least 7 characters of any value.
23. Find any line longer than 8 characters.
Look for a line with at least 9 characters of any value.
24. Find any line with exactly 5 characters.
Look for the start of the line, followed by 5 characters of any value,
followed by the end of the line.
25. Find any line with exactly 8 characters.
Look for the start of the line, followed by 8 characters of any value,
followed by the end of the line.
26. Find any line with exactly 2 characters.
Look for the start of the line, followed by 2 characters of any value,
followed by the end of the line.
27. Find any line with 1st word capitalized. There may be initial white-space.
Look for the start of the line. There may be zero or more occurances of
either space or tab, followed by a capital letter.
28. Find any line with with a word with the 2nd character capitalized.
Look for the start of a word, followed by a word character, followed
by a capital letter.
29. Find any line with a word with only the 2nd character capitalized.
Look for the start of a word, followed by a word character that is
a word character other than a capital, followed by a capital letter.
30. Find line that has exactly 3 words.
Look for the start of the line followed by zero or more non-word characters, followed by the start of a word followed by zero or more word characters, repeat ths pattern 2 more times and end with zero or more non-word characters until the end of the line.
31. Find any line with a word longer than 6 characters.
Look for a string composed of at least 7 word characters.
32. Find any line with a word longer than 10 characters.
Look for a string composed of at least 11 word characters.
33. Find any line with a word exactly 6 characters.
Look for a word composed of at exactly 7 word characters. For this one,
you will need to use the beginning and end of word markers. There may be
other shorter words on the line.
34. Find any line with a word exactly 10 characters.
Look for a word composed of at exactly 10 word characters. For this one,
you will need to use the beginning and end of word markers. There may be
other shorter words on the line.
35. find any line with two 6-character words anywhere on the line.
Look for the start of a word, followed by exactly 6 word characters
followed by the end of the word, followed by any number of any character,
followed by the start of a word, followed by exactly 6 word characters
followed by the end of a word.
36. Find any lines with no punctuation in it. But, do not match blank lines.
Look for the start of the line followed one or more word characters until
the end of the line.
37. Find any line with punctuation in it.
38. Find any line with at least 3 punctuations in it.
Look for a punctuation, followed by any number of any type of character,
followed by punctuation, followed by any number of any type of character,
followed by a punctuation.
39. Find any lines with no punctuation in it. Blank lines may match.
Look for the start of the line followed zero or more word characters until
the end of the line.
40. Find any line where only the last letter is capitalized.
Look for a line where the last word character is a capital letter. There
may be punctuation following to the end of the line.
41. Find any line that has at least 3 words.
Look for the start of a word followed by any number of word characters
followed by the end of the word, followed by any number of non-word characters.
Repeat pattern 2 more times.
Look for one or more word characters followed by one or more non-word
characters. Repeat this pattern and follow it by a third match on one or
more word characters.
42. Find any line with two words 6 characters long next to each other. There may be punctuation between the words.
Look for the beginning of a word followed by exactly 6 word characters
followed by one or more non-word characters, followed by 6 word characters
followed by the end of the word.
43. Find any line with a word that begins and ends with the same character.
Find the start of a word, remember the 1st character of the word. Look
for any number of word characters following it, followed by the remembered
character, followed by the end of the word.
44. Find any line with a word with the 2nd character and second to last characters match. Letters may be next to each other.
Find the start of a word, remember the 2nd character of the word. Look
for any number of word characters following it, followed by the remembered
character, followed by a word character, followed by the end of the word.
45. Find any line with a word with the 2nd character and second to last characters match. Letters must be separated by at least one other letter.
Find the start of a word, remember the 2nd character of the word. Look
for one or more word characters following it, followed by the remembered
character, followed by a word character, followed by the end of the word.
46. Find any line with 2 periods on the line.
Look for a period followed by any number of other characters followed by
a period. Remember to escape the period so it is a literal.
47. Find any lines with 2 6-character words next to each other separated by a punctuation and a space.
Look for beginning of a word, followed by any number of word characters,
followed by one punctuation character, followed by a space followed by 6 word
characters followed by the end of the word.
48. Find any line with a 5-character sequence repeated anywhere else on the line.
Remember a 5 character sequence of any value, followed by zero or more
chracters of any value followed by the remembered sequence.
49. Find any line with just 5-letters long. Line may end with punctuation. (6th character)
Look for the start of the line, followed by 5 letters of any value,
followed by zero or one punctuation character, followed by end of line.
50. Find any line with just 1 word and line ends with punctuation.
Look for the start of the line, followed by 1 or more word characters,
followed by one punctuation character, followed by end of line.
51. Find any line with just 2 words and at least one word is followed by punctuation.
Consider options to specify two alternative regular expressions.
Look for the start of line followed by 1 or more word characters, followed
by a punctuation followed by a space followed by one or more word characters,
followed by zero or one punctuations before end of line. Create a second
regular expression, only look for zero or one punctuations after 1 word and
one punctuation after 2nd word.
>
52. Find any line with a word less than 6 characters.
Look for the beginning of a word followed by 1 to 5 characters followed
by end of word. Longer words may also appear on line.
53. Find any line with a word less than 10 characters.
Look for the beginning of a word followed by 1 to 9 characters followed
by end of word. Longer words may also appear on line.
54. Find any line with only words less than 6 characters.
Consider options for finding non-matches.
You may get blank lines.
Use the option to invert the truth of the regular expression match. Then,
look for any lines with 6 word character sequences.
55. Find any line with only words less than 10 characters.
Consider otions for finding non-matches.
You may get blank lines.
Use the option to invert the truth of the regular expression match. Then,
look for any lines with 10 word character sequences.
56. Find any line with only words greater than 6 characters.
Consider options.
Use the option to invert the truth of the regular expression match. Then,
look for any lines with any words of one to 6 word character long.
57. Find any line with only words greater than 10 characters. Consider otions.
Use the option to invert the truth of the regular expression match. Then,
look for any lines with any words of one to 10 word character long.