This template takes a comma-separated string of names and looks for aliases that are set off by a forward slash ("/"), such as Dale Henson/slade. If found, the names are formatted like so: Dale Henson (as slade). Either name (or both) may be wikilinked. If no slash is found, the argument is returned unaltered.

The regular expression ([\w\.[:blank:]\[\]]+)\/([\w\.[:blank:]\[\]]+) is essentially two identical capture groups separated by a forward slash. The symbols used are as follows:

  • (…) - defines a capture group inside the parentheses.
  • \w - matches any word character, A through Z, 0 through 9, and the underscore, case insensitive.
  • \. - matches the period punctuation symbol.
  • [:blank:] - matches the space or the tab character.
  • \[ - matches the left square bracket.
  • \] - matches the right square bracket.
  • […]+ - matches one or more of any characters in the bracketed list.

The regex find/replace is performed by the regex parser function:

{{#rreplace:{{{1}}}|([\w\.[:blank:]\[\]]+)\/([\w\.[:blank:]\[\]]+)|$1 (as $2)}}

Where

  • $1 - gets replaced with the first capture group.
  • $2 - gets replaced with the second capture group.