|
13 | 13 | public class CrazyRegex {
|
14 | 14 |
|
15 | 15 | /**
|
16 |
| - * Create Pattern that accepts String with regex inside and can |
17 |
| - * find all words "Curiosity" in text |
| 16 | + * A Pattern that that finds all words "Curiosity" in text |
18 | 17 | *
|
19 |
| - * @return Pattern with regex expression |
| 18 | + * @return a pattern that looks for the word "Curiosity" |
20 | 19 | */
|
21 | 20 | public Pattern findSpecificWord() {
|
22 | 21 | throw new ExerciseNotCompletedException();
|
23 | 22 | }
|
24 | 23 |
|
25 | 24 | /**
|
26 |
| - * Create Pattern that accepts String with regex inside and can |
27 |
| - * find first word in text |
| 25 | + * A Pattern that finds first word in text |
28 | 26 | *
|
29 |
| - * @return Pattern with regex expression |
| 27 | + * @return a pattern that looks for the first word in text |
30 | 28 | */
|
31 | 29 | public Pattern findFirstWord() {
|
32 | 30 | throw new ExerciseNotCompletedException();
|
33 | 31 | }
|
34 | 32 |
|
35 | 33 | /**
|
36 |
| - * Create Pattern that accepts String with regex inside and can |
37 |
| - * find last word in text |
| 34 | + * A Pattern that finds last word in text |
38 | 35 | *
|
39 |
| - * @return Pattern with regex expression |
| 36 | + * @return a pattern that looks for the last word in text |
40 | 37 | */
|
41 | 38 | public Pattern findLastWord() {
|
42 | 39 | throw new ExerciseNotCompletedException();
|
43 | 40 | }
|
44 | 41 |
|
45 | 42 | /**
|
46 |
| - * Create Pattern that accepts String with regex inside and can |
47 |
| - * find all numbers in text |
| 43 | + * A Pattern that finds all numbers in text. When we have "555-555", "(555)555" and "30th" in text |
| 44 | + * our pattern must grab all that numbers: |
| 45 | + * "555" - four times, and one "30" |
48 | 46 | *
|
49 |
| - * @return Pattern with regex expression |
| 47 | + * @return a pattern that looks for numbers |
50 | 48 | */
|
51 | 49 | public Pattern findAllNumbers() {
|
52 | 50 | throw new ExerciseNotCompletedException();
|
53 | 51 | }
|
54 | 52 |
|
55 | 53 | /**
|
56 |
| - * Create Pattern that accepts String with regex inside and can |
57 |
| - * can find all dates like: 1971-11-23 |
| 54 | + * A Pattern that finds all dates. For instance: "1971-11-23" |
58 | 55 | *
|
59 |
| - * @return Pattern with regex expression |
| 56 | + * @return a pattern that looks for dates |
60 | 57 | */
|
61 | 58 | public Pattern findDates() {
|
62 | 59 | throw new ExerciseNotCompletedException();
|
63 | 60 | }
|
64 | 61 |
|
65 | 62 | /**
|
66 |
| - * Create Pattern that accepts String with regex inside and can |
67 |
| - * different variations of word 'color'. We are looking for: |
68 |
| - * 'color', 'colour', 'colors', 'colours' |
| 63 | + * A Pattern that finds different variations of word "color". |
| 64 | + * We are looking for: "color", "colour", "colors", "colours" |
69 | 65 | *
|
70 |
| - * @return Pattern with regex expression |
| 66 | + * @return a pattern that looks for different variations of word "color" |
71 | 67 | */
|
72 | 68 | public Pattern findDifferentSpellingsOfColor() {
|
73 | 69 | throw new ExerciseNotCompletedException();
|
74 | 70 | }
|
75 | 71 |
|
76 | 72 | /**
|
77 |
| - * Create Pattern that accepts String with regex inside and can |
78 |
| - * can find all zip codes in text |
| 73 | + * A Pattern that finds all zip codes in text. |
| 74 | + * Zip code is a 5-digit number without any characters or special symbols. |
| 75 | + * For example: 72300 |
79 | 76 | *
|
80 |
| - * @return Pattern with regex expression |
| 77 | + * @return a pattern that looks for zip codes |
81 | 78 | */
|
82 | 79 | public Pattern findZipCodes() {
|
83 | 80 | throw new ExerciseNotCompletedException();
|
84 | 81 | }
|
85 | 82 |
|
86 | 83 | /**
|
87 |
| - * Create Pattern that accepts String with regex inside and can |
88 |
| - * find different variations of word 'link', We are looking for: |
89 |
| - * 'lynk', 'link', 'l nk', 'l(nk' |
| 84 | + * A Pattern that finds different variations of word "link". |
| 85 | + * We are looking for: "lynk", "link", "l nk", "l(nk" |
90 | 86 | *
|
91 |
| - * @return Pattern with regex expression |
| 87 | + * @return a pattern that looks for different variations of word "link" |
92 | 88 | */
|
93 | 89 | public Pattern findDifferentSpellingsOfLink() {
|
94 | 90 | throw new ExerciseNotCompletedException();
|
95 | 91 | }
|
96 | 92 |
|
97 | 93 | /**
|
98 |
| - * Create Pattern that accepts String with regex inside and can |
99 |
| - * find phone number. For example: 555-555-5555 |
| 94 | + * A Pattern that finds phone numbers. |
| 95 | + * For example: "555-555-5555" |
100 | 96 | *
|
101 |
| - * @return Pattern with regex expression |
| 97 | + * @return a pattern that looks for phone numbers |
102 | 98 | */
|
103 | 99 | public Pattern findSimplePhoneNumber() {
|
104 | 100 | throw new ExerciseNotCompletedException();
|
105 | 101 | }
|
106 | 102 |
|
107 | 103 | /**
|
108 |
| - * Create Pattern that accepts String with regex inside and can |
109 |
| - * can find numbers with following requirements: |
| 104 | + * A Pattern that finds numbers with following requirements: |
110 | 105 | * - inside the number can be only digits from 0 to 5
|
111 | 106 | * - length 3
|
112 | 107 | *
|
113 |
| - * @return Pattern with regex expression |
| 108 | + * @return a pattern that looks for numbers with length 3 and digits from 0 to 5 in the middle |
114 | 109 | */
|
115 | 110 | public Pattern findNumbersFromZeroToFiveWithLengthThree() {
|
116 | 111 | throw new ExerciseNotCompletedException();
|
117 | 112 | }
|
118 | 113 |
|
119 | 114 | /**
|
120 |
| - * Create Pattern that accepts String with regex inside and can |
121 |
| - * find all words in text that have length 5 |
| 115 | + * A Pattern that finds all words in text that have length 5 |
122 | 116 | *
|
123 |
| - * @return Pattern with regex expression |
| 117 | + * @return a pattern that looks for the words that have length 5 |
124 | 118 | */
|
125 | 119 | public Pattern findAllWordsWithFiveLength() {
|
126 | 120 | throw new ExerciseNotCompletedException();
|
127 | 121 | }
|
128 | 122 |
|
129 | 123 | /**
|
130 |
| - * Create Pattern that accepts String with regex inside and can |
131 |
| - * find words and numbers with following constraints: |
| 124 | + * A Pattern that finds words and numbers with following constraints: |
132 | 125 | * - not shorter than two symbols
|
133 | 126 | * - not longer than three symbols
|
134 | 127 | *
|
135 |
| - * @return Pattern with regex expression |
| 128 | + * @return a pattern that looks for words and numbers that not shorter 2 and not longer 3 |
136 | 129 | */
|
137 | 130 | public Pattern findAllLettersAndDigitsWithLengthThree() {
|
138 | 131 | throw new ExerciseNotCompletedException();
|
139 | 132 | }
|
140 | 133 |
|
141 | 134 | /**
|
142 |
| - * Create Pattern that accepts String with regex inside and can |
143 |
| - * find all words that begin with capital letter |
| 135 | + * A Pattern that finds all words that begin with capital letter |
144 | 136 | *
|
145 |
| - * @return Pattern with regex expression |
| 137 | + * @return a pattern that looks for the words that begin with capital letter |
146 | 138 | */
|
147 | 139 | public Pattern findAllWordsWhichBeginWithCapitalLetter() {
|
148 | 140 | throw new ExerciseNotCompletedException();
|
149 | 141 | }
|
150 | 142 |
|
151 | 143 | /**
|
152 |
| - * Create Pattern that accepts String with regex inside and can |
153 |
| - * find only the following abbreviation: |
| 144 | + * A Pattern that finds only the following abbreviation: |
154 | 145 | * - AK, AL, AR, AZ, CA, CO, CT, PR, PA, PD
|
155 | 146 | *
|
156 |
| - * @return Pattern with regex expression |
| 147 | + * @return a pattern that looks for the abbreviations above |
157 | 148 | */
|
158 | 149 | public Pattern findAbbreviation() {
|
159 | 150 | throw new ExerciseNotCompletedException();
|
160 | 151 | }
|
161 | 152 |
|
162 | 153 | /**
|
163 |
| - * Create Pattern that accepts String with regex inside and can |
164 |
| - * find all open braces |
| 154 | + * A Pattern that finds all open braces |
165 | 155 | *
|
166 |
| - * @return Pattern with regex expression |
| 156 | + * @return a pattern that looks for all open braces |
167 | 157 | */
|
168 | 158 | public Pattern findAllOpenBraces() {
|
169 | 159 | throw new ExerciseNotCompletedException();
|
170 | 160 | }
|
171 | 161 |
|
172 | 162 | /**
|
173 |
| - * Create Pattern that accepts String with regex inside and can |
174 |
| - * find everything inside [] |
| 163 | + * A Pattern that finds everything inside [] |
175 | 164 | *
|
176 |
| - * @return Pattern with regex expression |
| 165 | + * @return a pattern that looks for everything inside [] |
177 | 166 | */
|
178 | 167 | public Pattern findOnlyResources() {
|
179 | 168 | throw new ExerciseNotCompletedException();
|
180 | 169 | }
|
181 | 170 |
|
182 | 171 | /**
|
183 |
| - * Create Pattern that accepts String with regex inside and can |
184 |
| - * find all http links inside () |
| 172 | + * A Pattern that finds all https links in note.txt |
185 | 173 | *
|
186 |
| - * @return Pattern with regex expression |
| 174 | + * @return a pattern that looks for all https links in note.txt |
187 | 175 | */
|
188 | 176 | public Pattern findOnlyLinksInNote() {
|
189 | 177 | throw new ExerciseNotCompletedException();
|
190 | 178 | }
|
191 | 179 |
|
192 | 180 | /**
|
193 |
| - * Create Pattern that accepts String with regex inside and can |
194 |
| - * all http links |
| 181 | + * A Pattern that finds all http links in nasa.json |
195 | 182 | *
|
196 |
| - * @return Pattern with regex expression |
| 183 | + * @return a pattern that looks for all http links in nasa.json |
197 | 184 | */
|
198 | 185 | public Pattern findOnlyLinksInJson() {
|
199 | 186 | throw new ExerciseNotCompletedException();
|
200 | 187 | }
|
201 | 188 |
|
202 | 189 | /**
|
203 |
| - * Create Pattern that accepts String with regex inside and can |
204 |
| - * find all .com, .net and .edu emails |
| 190 | + * A Pattern that finds all .com, .net and .edu emails |
205 | 191 | *
|
206 |
| - * @return Pattern with regex expression |
| 192 | + * @return a pattern that looks for all .com, .net and .edu emails |
207 | 193 | */
|
208 | 194 | public Pattern findAllEmails() {
|
209 | 195 | throw new ExerciseNotCompletedException();
|
210 | 196 | }
|
211 | 197 |
|
212 | 198 | /**
|
213 |
| - * Create Pattern that accepts String with regex inside and can |
214 |
| - * can find the following examples of phone numbers: |
| 199 | + * A Pattern that finds the following examples of phone numbers: |
215 | 200 | * - 555-555-5555
|
216 | 201 | * - 555.555.5555
|
217 | 202 | * - (555)555-5555
|
218 | 203 | *
|
219 |
| - * @return Pattern with regex expression |
| 204 | + * @return a pattern that looks for phone numbers patterns above |
220 | 205 | */
|
221 | 206 | public Pattern findAllPatternsForPhoneNumbers() {
|
222 | 207 | throw new ExerciseNotCompletedException();
|
223 | 208 | }
|
224 | 209 |
|
225 | 210 | /**
|
226 |
| - * Create Pattern that accepts String with regex inside and can |
227 |
| - * find only duplicates |
| 211 | + * A Pattern that finds only duplicates |
228 | 212 | *
|
229 |
| - * @return Pattern with regex expression |
| 213 | + * @return a pattern that looks for duplicates |
230 | 214 | */
|
231 | 215 | public Pattern findOnlyDuplicates() {
|
232 | 216 | throw new ExerciseNotCompletedException();
|
@@ -265,4 +249,6 @@ public String replaceLastSevenDigitsOfPhoneNumberToX(String phones) {
|
265 | 249 | public String insertLinksAndResourcesIntoHref(String links) {
|
266 | 250 | throw new ExerciseNotCompletedException();
|
267 | 251 | }
|
| 252 | + |
| 253 | + |
268 | 254 | }
|
0 commit comments