Informatics1-2019/HW3
A MathWikiből
(Változatok közti eltérés)
10. sor: | 10. sor: | ||
== Example== | == Example== | ||
− | These should be ''' | + | These should be '''matched''': |
* 4 | * 4 |
A lap 2019. október 7., 15:00-kori változata
REGEX
You have to write regular expressions matching specific patterns. Use this page: https://regex101.com/ and don't forget to set python flavor.
Tartalomjegyzék |
Leap years (2 points)
Match the leap years in this specific way: a positive integer divisible by 4, except multiples of 100.
Example
These should be matched:
- 4
- 8
- 12
- 16
- 160
- 164
- 1024
- 2008
- 2056
- 20080
- 1048576
These should not match:
- 1
- 2
- 3
- 5
- 9
- 11
- 13
- 21
- 22
- 23
- 100
- 0
- 2000
- 1600
- 200800
Vowel harmony (2 points)
The expression should find words containing only lowercase, latin characters.
- A word should be matched if it uses only the same vowel every time
- contains at least two vowels
- It can start with any number of consonants, or a vowel.
- two vowels should not be next to each other.
- it should match a whole word
Hint
For vowels you can use:
[aeiou]
And for consonants:
[^aeiou\s]
Also put \b in front and to the end, to make sure it matches a whole word.
Example
These should be matched:
- mammal
- mama
- uru
- chlorophorm
- oppo
- imimi
- xerxes
- these
These should not match:
- mammut
- url
- choroid
- opponent
- coop
- iii
Handing in
Write the two regular expressions in an email to info1hazi@gmail.com from your math account. The subject should be:
A1_HW3_<username>
Deadline
2019. October 13th 23:59