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.
a bash script: write commands into a file, similar like the ones in konsole.
+
The commands should do the following:
+
  
* Make a directory called <tt>html</tt> in the home folder ('''mkdir''')
+
The expression should find words containing only lowercase, latin characters.
* enter that directory ('''cd''')
+
* A word should be matched if it uses only the same vowel every time
* download any <tt>.html</tt> file from the internet, for example [http://sandbox.hlt.bme.hu/~gaebor/ea_anyag/Info1/ here] ('''wget''')
+
* contains at least two vowels
* count how many lines contain the word '''href'''
+
* It can start with any number of consonants, or a vowel.
* finally, enter the parent directory (back to home folder)
+
* two vowels should not be next to each other.
 +
* it should match a whole word only
  
=== script ===
+
== Hint ==
You can try the commands in konsole, and write them in a file with extension '''<tt>.sh</tt>''', attach the '''<tt>.sh</tt>''' file to your email.
+
For vowels you can use:
  
You can execute the commands in the file at once with '''bash'''
+
    [aeiou]
  
     bash >>something.sh<<
+
And for consonants:
== Hint ==
+
 
See the manuals like:
+
     [^aeiou\s]
 +
 
 +
== Example==
 +
 
 +
These should be ''match''ed:
 +
 
 +
* mammal
 +
* chlorophorm
 +
* oppo
 +
 
 +
these shuold '''not match''':
 +
* mammut
 +
* choroid
 +
* opponent
  
    man cd
 
    man wc
 
    man ...
 
  
 
== Deadline ==
 
== Deadline ==
 
2019. October 13<sup>th</sup> 23:59
 
2019. October 13<sup>th</sup> 23:59

A lap 2019. október 7., 13: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

Személyes eszközök