Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Replace character expression
Message
From
12/07/2010 12:51:22
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01471799
Message ID:
01472240
Views:
55
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform