Informatics1-2019/HW3
A MathWikiből
(Változatok közti eltérés)
(Új oldal, tartalma: „= Regex = You have to write a regular expression matching a specific pattern. Use this page: a bash script: write commands into a file, similar like the ones in konso…”) |
|||
1. sor: | 1. sor: | ||
− | = Regex = | + | =Regex (3 points)= |
You have to write a regular expression matching a specific pattern. | You have to write a regular expression matching a specific pattern. | ||
− | Use this page: | + | Use this page: https://regex101.com/ and don't forget to set '''python''' flavor. |
− | + | ||
− | + | ||
− | * | + | 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 only | ||
− | == | + | == Hint == |
− | + | For vowels you can use: | |
− | + | [aeiou] | |
− | + | And for consonants: | |
− | == | + | |
− | + | [^aeiou\s] | |
+ | |||
+ | == Example== | ||
+ | |||
+ | These should be ''match''ed: | ||
+ | |||
+ | * mammal | ||
+ | * chlorophorm | ||
+ | * oppo | ||
+ | |||
+ | these shuold '''not match''': | ||
+ | * mammut | ||
+ | * choroid | ||
+ | * opponent | ||
− | |||
− | |||
− | |||
== Deadline == | == Deadline == | ||
2019. October 13<sup>th</sup> 23:59 | 2019. October 13<sup>th</sup> 23:59 |
A lap 2019. október 7., 14:38-kori változata
Tartalomjegyzék |
Regex (3 points)
You have to write a regular expression matching a specific pattern. Use this page: https://regex101.com/ and don't forget to set python flavor.
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 only
Hint
For vowels you can use:
[aeiou]
And for consonants:
[^aeiou\s]
Example
These should be matched:
- mammal
- chlorophorm
- oppo
these shuold not match:
- mammut
- choroid
- opponent
Deadline
2019. October 13th 23:59