17.12.2012 Views

Programmation PYTHON - Zenk - Security - Repository

Programmation PYTHON - Zenk - Security - Repository

Programmation PYTHON - Zenk - Security - Repository

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

324<br />

La bibliothèque standard<br />

TROISIÈME PARTIE<br />

(?=e) Similaire à (e) mais le groupe n’est pas<br />

consommé.<br />

(?!e) Le groupe n’est pas consommé et est<br />

intercepté uniquement si le pattern (le<br />

motif) n’est pas e. (?!e) est le symbole<br />

inverse de (?=e)<br />

(?.<br />

>>> re.findall(r'John(?= Doe)',<br />

'John Doe')<br />

['John']<br />

>>> re.findall(r'John(?= Doe)',<br />

'John Minor')<br />

[]<br />

>>> re.findall(r'John(?! Doe)',<br />

'John Doe')<br />

[]<br />

>>> re.findall(r'John(?! Doe)',<br />

'John Minor')<br />

['John']<br />

>>> re.findall(r'(?)'<br />

, '123>')<br />

>>><br />

re.match(r'(?P)'<br />

, '123')<br />

<br />

>>><br />

re.match(r'(?P)'<br />

, '')<br />

<br />

Voici une série d’exemples plus complets, mettant en œuvre les différentes mécaniques.<br />

L’expression est optionnellement accompagnée de flags.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!