Différences entre les versions de « Regexp »

(Page créée avec « Catégorie:Commandes == Description == == Guide== == Exemples== ==Voir aussi== »)
 
Ligne 3 : Ligne 3 :
  
 
== Guide==
 
== Guide==
 +
{| class="wikitable"  style="margin: auto; text-align: center;"
 +
|+Les métacaractères
 +
|-
 +
! Metacaractères !! Signification
 +
|-
 +
? The ? (question mark) matches the preceding character 0 or 1 times only, for example, colou?r will find both color and colour.
 +
|-
 +
!* || The * (asterisk or star) matches the preceding character 0 or more times, for example, tre* will find tree and tread and trough.
 +
|-
 +
!+ || The + (plus) matches the previous character 1 or more times, for example, tre+ will find tree and tread but not trough.
 +
|-
 +
!{n}||Matches the preceding character n times exactly, for example, to find a local phone number we could use [0-9]{3}-[0-9]{4} which would find any number of the form 123-4567.
 +
|-
 +
|}
 +
Note: The - (dash) in this case, because it is outside the square brackets, is a literal. Value is enclosed in braces (curly brackets).
 +
{n,m} Matches the preceding character at least n times but not more than m times, for example, 'ba{2,3}b' will find 'baab' and 'baaab' but NOT 'bab' or 'baaaab'. Values are enclosed in braces (curly brackets).
 
== Exemples==
 
== Exemples==
 
==Voir aussi==
 
==Voir aussi==

Version du 16 décembre 2010 à 10:47

Description

Guide

? The ? (question mark) matches the preceding character 0 or 1 times only, for example, colou?r will find both color and colour.
Les métacaractères
Metacaractères Signification
* The * (asterisk or star) matches the preceding character 0 or more times, for example, tre* will find tree and tread and trough.
+ The + (plus) matches the previous character 1 or more times, for example, tre+ will find tree and tread but not trough.
{n} Matches the preceding character n times exactly, for example, to find a local phone number we could use [0-9]{3}-[0-9]{4} which would find any number of the form 123-4567.

Note: The - (dash) in this case, because it is outside the square brackets, is a literal. Value is enclosed in braces (curly brackets). {n,m} Matches the preceding character at least n times but not more than m times, for example, 'ba{2,3}b' will find 'baab' and 'baaab' but NOT 'bab' or 'baaaab'. Values are enclosed in braces (curly brackets).

Exemples

Voir aussi


La dernière modification de cette page a été faite le 16 décembre 2010 à 10:47.