match. Replacing pattern-matching substring

^string.match[pattern][search options]{replacer}
^string.match[pattern][search options][replacer]
^string.match[pattern][search options]{replacer}{returns this if the pattern wasn't be found in the string}

The method searches the string for a match and replaces the pattern-matching substring with a substring given in curly brackets. The search mechanism is the same as in the previously given method. Automatically created matches' table
match, described in the previous method, is available within the code.

Year: $match.1month: $match.2day: $match.3}

The code will output:
Year: 2002, month: 01, day: 01

Copyright © 1997–2017 Art. Lebedev Studio | Last updated: 15.06.2012