Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replace character expression
Message
De
12/07/2010 12:51:22
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01471799
Message ID:
01472240
Vues:
56
The pattern works as follows:
\[ indicates you are matching an opening bracket. The \ is an escape character to indicate the next character is literal, as brackets are special characters in regular expressions.

([1-9]) indicates that you will be matching any character between 1-9. The parenthesis indicate a group, which is kept separate from the whole match and which we need later for the replace. The brackets are used to indicate that any of the contained characters can be a match, in this case the range 1-9.

- just matches the literal -.

\d in my pattern matches a single numeric digit.

The replace function replaces anything that matches the entire pattern with the second parameter. The $ followed by a digit indicates the group to be used there. So $1 indicates to use the match found in the first group, and $2 uses the match from the second group.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform