When I need it, I tend to forget how to create a regular expression that matches a large set of strings but does not match some specific strings. It's tricky because it involves the negative lookahead syntax.
For exemple the regexp
.+\.java
matches any java filename.
But the following regexp
(?!Foo\.java).+\.java
matches any java filename except Foo.java because the negative lookahead of Foo\.java will prevent .+\.java from matching.
The negative lookahead syntax is
(?!X) where X is the string that must not be matched.
Affichage des articles dont le libellé est regexp. Afficher tous les articles
Affichage des articles dont le libellé est regexp. Afficher tous les articles
mardi 23 décembre 2008
Inscription à :
Articles (Atom)