Abstract: package Advanced::Perl5_10::Regular::Expressions;
use 5.010;
=head1 NAME
Advanced::Perl5_10::Regular::Expressions
=head1 SYNOPSIS
Ziel dieses Vortrags ist es, verschiedene Konzepte der regulären
Ausdrücke vorzustellen. Es werden sowohl Features der aktuellen
Perl Version behandelt als auch die neuen Features in Perl 5.10,
die schon in Perl 5.9.5 vorhanden sind. Die Zielgruppe sind
Zuhörer, die hinreichend vertraut mit der derzeitigen Syntax für
reguläre Ausdrücke sind und ein tieferes Verständnis gewinnen
möchten. Der Vortrag kann als 40 minütiger Langvortrag oder
halbtätiges Tutorial gehalten werden.
=head1 ABSTRACT
Ich fange mit einer kurzen Zusammenfassung der existierenden
Syntax an, Zeichenklassen, Alternativen und Wiederholungszeichen.
Die C<re 'debug'> Features werden verwendet, um das Backtracking
zu erklären und mehrere Fallstricke zu erläutern, wie doppelte
Wiederholungszeichen und unnötiges Backtracking. Ich zeige,
wie man mit fortgeschrittenen Mustern, wie C<< (?>...) >>
die Mustererkennung beschleunigen kann, indem man das
Backtracking eliminiert. Das Erkennen rekursiver Muster wird
mit C<qr//> und C<(??{})> gezeigt, und auch, wann die
eher esoterischen Konstrukte, wie C<(?(..)...|...)> eingesetzt
werden können. Die unbekannteren Variablen C<@->, C<@+>, C<$^R>
und C<$+> werden auch betrachtet.
Als Abschluss gebe ich einen kurzen Überblick über die
bestehenden Module zum Erzeugen von optimierten Mustern
für eine bekannte Wortmenge.
Der zweite Teil des Vortrags beschäftigt sich dann
mit den Neuigkeiten in Perl 5.10:
=over 4
=item 1
Einführung der Notation für benannte Muster C<< (?<NAME>...) \k<NAME>
>>
und des neuen C<%+> Hash.
=item 2
Die neue Syntax erlaubt rekursive Mustererkennung ohne
Perl Code. Ich zeige, wie die vorigen Beispiele effizienter
umgeschrieben werden können. Dies entspricht
der C<(?1)> und C<(?&NAME)> Direktive.
=item 3
Diskussion der neuen bedingten Muster C<(?(R)...|...)> und
C<(?(R&NAME)....)>.
=item 4
Einführung von C<(?(DEFINE)...)> und C<(?FAIL)>,
möglicherweise auch noch mehr Verben, falls diese
rechtzeitig implementiert werden.
=item 5
Vereinfachung von Mustern durch C<< (?>...) >>
=item 6
Vorstellung der neuen TRIE-Optimierung, und wie man
diese optimal mit eigenen regulären Ausdrücken ausnutzt.
=back
Sollte danach noch Zeit verbleiben, werde ich eine Frage-und-Antwort
Session halten. Wichtig ist noch, dass ich derzeit am Code für
die Regex Engine arbeite und viele neue Features dazukommen - es
können
also mehr Features kommen, als hier angegeben.
=head1 AUTHOR
Yves Orton ( C< $_='@gmail.com'; s/^/demerphq/; >)
Translation by Max Maischein
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2006 by Yves Orton. You may alter and and reproduce this
document as you wish so long as my contribution to the final document
is acknowledged.
=cut
Abstract EN: package Advanced::Perl5_10::Regular::Expressions;
use 5.010;
=head1 NAME
Advanced::Perl5_10::Regular::Expressions
=head1 SYNOPSIS
The intention of this talk will be to introduce people to various
advanced regular expression concept both in current perl and the
features that will be new as of version 5.10 (and are already existant
in perl 5.9.5). Its intended for people who are reasonably aware of
current Perl regex syntax and are looking for a deeper insight. Its
aimed at either a 40 minute talk or a half day tutorial.
=head1 ABSTRACT
I'll start off with a brief discussion of existing syntax, such as
character classes, alternations and quantifiers. I'll use the re
'debug'
features of perl to explain how backtracking works and explain some
common pitfalls of regular expressions, such as double quantifiers, and
unnecessary backtracking. I'll show how advanced patterns like C<<
(?>...) >>
can be used to speed up patterns by eliminating unnecessary
backtracking. I'll demonstrate how C<qr//> and the C<(??{})> patterns
can be
used to do recursive patterns, and I'll illustrate how more esoteric
structures like C<(?(..)...|...)> can be used. I'll discuss the lesser
known regexp variables, C<@->, C<@+>, C<$^R>, and C<$+>. In addition
I will give a brief discussion on using regexp builder modules to
produce
optimized patterns.
Once I've covered the material only available in perl 5.8 and earlier
I'll move on to perl 5.10. In this section I will cover:
=over 4
=item 1
Introduce the named capture buffer notation C<< (?<NAME>...) \k<NAME>
>>
and the new C<%+>hash.
=item 2
The new syntax that allows for codeless recursive matching and show how
the earlier examples could be rewritten to be more efficient. This
corresponds to C<(?1)> and C<(?&NAME)>
=item 3
Discuss the new conditionals C<(?(R)...|...)> and C<(?(R&NAME)....)>.
=item 4
Introduce the new regex control verbs C<(?(DEFINE)...)> and C<(?FAIL)>,
(possibly more if they are implemented in time.)
=item 5
Discuss how possessive quantifiers can be used to simplify patterns
using C<< (?>....) >>
=item 6
Discuss the impact of the new TRIE optimisations, and how they should
change how people think about their patterns.
=back
Once all of this is done assuming time remains I will do a Q&A session.
Also its worth noting that I am currently actively working on the regex
engine and new features are being added all the time, so there may be
more covered than listed here.
=head1 AUTHOR
Yves Orton ( C< $_='@gmail.com'; s/^/demerphq/; >)
=cut