Différences entre les versions de « Regexp »
(→Guide) |
|||
Ligne 8 : | Ligne 8 : | ||
! Metacaractères !! Signification | ! 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 ? (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 * (asterisk or star) matches the preceding character 0 or more times, for example, tre* will find tree and tread and trough. | ||
Ligne 19 : | Ligne 19 : | ||
Note: The - (dash) in this case, because it is outside the square brackets, is a literal. Value is enclosed in braces (curly brackets). | 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). | {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 à 09:48
Description
Guide
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
Voir aussi
La dernière modification de cette page a été faite le 16 décembre 2010 à 09:48.