RegEx in practice
This is a page dedicated to my talk "RegEx in practice". It is meant to illustrate how to apply regular expressions in practical usecases and tries to resolve confusions about them.
Thanks for that much participation. I updated the slides for the 6 errors.
One other bug I discovered: I claimed a group which did not match is returned in python as empty string. No, it is actually None
.
Title | RegEx in practice |
---|---|
Date | Thu, 27th of Nov 2014, 18:00–20:00 |
Location | Austria, Graz, Infeldgasse 25D, i7 |
Lecturer | Lukas Prokop |
Language | german |
Topics
This is a technical talk and focuses on some aspects of practical computer science. It will focus on advanced elements of regular expressions.
- Usecase analysis
- Elements of regular expressions
- Resolving confusions
- RegEx engines
- RegEx for some practical usecases
Resources
Slides as PDF and slides archive
- Audio recording (OGG, 75 MB) [post-processed via Auphonic; thx!] of my talk from speaker's desk. Only meant to be used for rhetorics analysis, but you can have it if you want to.
- The three suggested links (accessed 27th of Nov 2014):
- http://swtch.com/~rsc/regexp/, Russ Cox.
- http://www.unicode.org/reports/tr18/, Unicode Consortium.
- speakerdeck:unicode-regular-expression-engines, Nick Patch
- Most recently wordpress 4.0.1 fixed a severe security problem (most severe security vulnerability in WP since 2009 as they say). The problem originates from a faulty regular expression. Read about it from the bug reporters.
- CSS selector demonstration
- Python RegEx cheatsheet
- awk RegEx cheatsheet
- sed RegEx cheatsheet
Video
Want to see how I apply regular expressions in practice? Do you remember that faulty turingmachine visualization? It did not support Chrome so far, because -webkit-
prefixed CSS instructions are missing. I fixed that problem using regular expressions. I am using the following command in vim:
'<,'>
), replace (s/search/replace/g
)
the animation attribute and its value (\([^;]\+\);
escaped for vim)
with itself (&
) and its webkit-prefixed version ( -webkit-&
).
The grouping can actually be omitted. In the second regular expression I duplicate all instructions and replace @keyframes
with @-webkit-keyframes
.