$regsub: Difference between revisions
Jump to navigation
Jump to search
m removing stub-pages, added content |
mNo edit summary |
||
| Line 12: | Line 12: | ||
[[Category:Regular_Expression]] | [[Category:Regular_Expression]] | ||
[[Category:Identifiers]] | |||
Revision as of 23:17, 2 February 2011
$regsub([name], text, re, subtext, %var)
Performs a regular expression match, like $regex(), and then performs a substitution using subtext.
Returns N, the number of substitutions made, and assigns the result to %var.
Example:
alias testing {
var %num_of_matches = $regsub(a dog was eating milk,/dog/g,cat,%new_content)
;%num_of_matches will have a value of 1, since 'dog' was mathced once
;%new_content will be 'a cat was eating milk'
}