Lesson 1 -https://regexone.com/lesson/introduction_abcs
Task Text
Match abcdefg
Match abcde
Match abc
Solutions:
^abc\w*
Lesson 1½ -https://regexone.com/lesson/letters_and_digits?
Task Text
Match abc123xyz
Match define"123"
Match vaar g=123;
Solutions:
\w+\s?.+
Lesson 2 - https://regexone.com/lesson/wildcards_dot?
Match cat.
Match 896
Match ?=+.
Match abc1
Solutions:
.+[^abc1]
Lesson 3 -https://regexone.com/lesson/matching_characters?
Objective:
match can
match man
match fan
skip dan
skip ran
skip pan
Solutions:
[cmf]+[an]+
Lesson 4 - https://regexone.com/lesson/excluding_characters?
Objective:
match hog
match dog
skip bog
Solutions:
([d-o]+)[^bg]
Lesson 5 -https://regexone.com/lesson/character_ranges
Objective:
match Ana
match Bob
match CpC
skip aax
skip bby
skip ccz
Solutions:
^[A-C]+[n-p]+[a-c]
```
#### Lesson 6 - https://regexone.com/lesson/repeating_characters
Objective:
match wazzzzup
match wazzzup
skip wazup
Solutions:
([wa]+[z]{3,4}[up]+)
#### Lesson 7 -https://regexone.com/lesson/kleene_operators?
Objective:
match aaaabcc
match aabbbbc
match aacc
Solutions:
(a+b*c+)
#### Lesson 8 -https://regexone.com/lesson/optional_characters
Objective:
match 1 file found?
match 2 files found?
match x files found?
skip No files found?
Solutions:
[\d]+\s[file?s]+\s[found]+?
#### Lesson 9 -https://regexone.com/lesson/whitespaces?
Objective:
match 1. abc
match 2. abc
match 3. abc
skip 4.abc
Solutions:
[\d\.]+\s+[a-c]+ # 查找多个空格方法
#### Lession 10 -https://regexone.com/lesson/line_beginning_end?
Objective:
match Mission: successful
skip Last Mission: unsuccessful
skip Next Mission: successful upon capture of target
Solutions:
^([a-zA-z]+\:\s?successful)$
#### Lession 11 - https://regexone.com/lesson/capturing_groups?
Objective:
match file_a_record_file.pdf
match file_yesterday.pdf
skip testfile_fake.pdf.tmp
Solutions:
^([a-z+_?\d+]+).pdf$
#### Lesson 12 - https://regexone.com/lesson/nested_groups?
Objective:
match Jan 1987 capture Jan 1987, 1987
match May 1969 capture May 1969, 1969
match Aug 2011 capture Aug 2011, 2011
Solutions:
^([a-zA-z]+\s+([\d]+))$
#### Lesson 13 - https://regexone.com/lesson/more_groups?
Objective:
Capture 1280x720
Capture 1920x1600
Capture 1024x768
Solution:
^(\d{3,4})x(\d{3,4})$
#### Lesson 14 - https://regexone.com/lesson/conditionals?
Match I love cats
Match I love dogs
Skip I love logs
Skip I love cogs
^.([c]ats|[d]ogs?)
####Lesson 15 - https://regexone.com/lesson/misc_meta_characters?
Match The quick brown fox jumps over the lazy dog.
Match There were 614 instances of students getting 90.0% or above.
Match The FCC had to censor the network for saying &$#*@!
(\w+)\s(\w+)(\d)*.+
网友评论