StringTools[RegSubs] - perform regular expression substitutions
|
Calling Sequence
|
|
RegSubs( env, text )
|
|
Parameters
|
|
env
|
-
|
string = string; substitution to make
|
text
|
-
|
string; text to substitute into
|
|
|
|
|
Description
|
|
•
|
The RegSubs(env,text) command replaces each occurrence of a substring matching the left-hand side of env with the right-hand side of env in the string text.
|
|
If no substring of text matches the left-hand side of env, then text is returned unchanged.
|
•
|
This procedure is closely related to StringTools[RegSub], but provides a more intuitive interface. The chief difference between the two is that RegSubs effects all relevant substitutions (serially), while StringTools[RegSub] performs a single substitution. Also, the left-hand side of env cannot match an empty substring of text. (An exception is raised in this case.)
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
>
|
|
| (6) |
>
|
|
| (7) |
|
|
Download Help Document
Was this information helpful?