lehrkraefte:blc:informatik:glf4-20:datenextraktion

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lehrkraefte:blc:informatik:glf4-20:datenextraktion [2021/02/08 13:42]
Ivo Blöchliger [Zeichenklassen]
lehrkraefte:blc:informatik:glf4-20:datenextraktion [2021/02/08 14:08] (current)
Ivo Blöchliger
Line 1: Line 1:
 ====== Regular Expressions ====== ====== Regular Expressions ======
 +
 +===== Ausprobieren in der Konsole =====
 +Wichtig: Das Module ''re'' (Regular Expressions) muss einmal importiert werden.
 +<code python>
 +import re
 +
 +re.findall(".ie.", "Viele Beispiele eieiei!")
 +# Liefert ["Viel", "piel", "eiei"]
 +
 +re.findall("(\d{1,2})-(\d{1,2})-(\d{4})", "Am 9-11-2013 war Samstag und am 10-11-2013 Sonntag.")
 +# Liefert [("9", "11", "2013"), ("10", "11", "2013")]
 +</code>
 +
  
 ===== Cheat Sheet ===== ===== Cheat Sheet =====
Line 20: Line 33:
 | \s | Ein Leerschlag oder Tabulator| | |  | \s | Ein Leerschlag oder Tabulator| | | 
 | \n | Ein Zeilenumbruch | | | | \n | Ein Zeilenumbruch | | |
-| \\ | Ein Backslash | \ | / |+<nowiki>\\</nowiki> | Ein Backslash | \ | / |
 | \. | Ein Punkt | . | x | | \. | Ein Punkt | . | x |
 | \( | Eine Klammer | ( | ) | | \( | Eine Klammer | ( | ) |
  • lehrkraefte/blc/informatik/glf4-20/datenextraktion.1612788168.txt.gz
  • Last modified: 2021/02/08 13:42
  • by Ivo Blöchliger