Interpolate scoreboard component support replacing by regex

 

The Interpolate scoreboard component now has a "replace" property which takes a hash, where the key is a regex to search for and the value the replacement string. The value can reference the complete match with $& or individual capture groups with $1, $2 etc as per standard javascript regex replace. Click here for more details.

Below example changes the order of the rider name; Peder Fredricson becomes Fredricson, Peder

{
  "component": "Interpolate",
  "mapping": {
    "name": [
      "current",
      "rider_name"
    ]
  },
  "value": "%{name}",
  "replace": {
    "(\\w+) (.*)": "$2, $1"
  }
}