SlideServe
Menu
Préférences
© SlideServe · v2026

Regular Expressions

berne avatar
8 diapositives · 318 Views · Jul 29, 2014

Regular Expressions. The ultimate tool for textual analysis. What is regular expression?. Regular Expressions are strings that encode some patterns, according some rules

Regular Expressions - slide 1
01 / 8Regular Expressions
1 / 17

Télécharger la présentation

Regular Expressions
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Regular Expressions The ultimate tool for textual analysis

  2. What is regular expression? • Regular Expressions are strings that encode some patterns, according some rules • If you have a regular expression parsing and searching program, (Python provides one) you can search for all strings that match some patterns within some text

  3. Rule 1 • All non-meta characters match themselves • Find "Ishmael" in Moby Dick • Click on show context

  4. Rule 2 • [] or | allows you match any of a number of characters [abc] or a|b|c matches a, or b, or c • Try to find all occurrences of "this". It may appear at the beginning of a sentence.

  5. Rule 3 • \w matches all alphanumerical characters • \W matches all non-alphanumerical characters • * matches zero or more occurrences of the preceding character ab* matches a, or ab, or abb, or abbb, or … • Try find approximately all adverbs (words ending with –ly) in Moby Dick. Note that you should not find flying.

  6. Rule 4 • dot (.) matches all characters except new lines (\n). a.b matches aab, or abb, or acb, or abd, or a-b, or a#b, or… • You are Tasking to solve a crossword puzzle, and you've come to the following: C A ? T H E A • What is the missing letter?

  7. Rule 5 • * matches zero or more occurrences of the preceding character • + matches one or more occurrences of the preceding character • ? matches zero or one occurrences of the preceding character

  8. Rule 6 • () groups characters together so that they act as one when working with *, +, ? • In the search result, you can also ask to show a chosen group • Find the words modified by your adverbs (i.e., the word just after the adverb). put the adverb and any space, punctuation in one group and the modified word in another. Turn on and off 'show groups' checkbox to see what it does.