General information
Category:
Coding, syntax & commands
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only