Thanks to visit codestin.com
Credit goes to nativescript-strformat.readme.io

exec

Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search.

import {StringBuilder} from "nativescript-stringformat";

var result = new StringBuilder("{0} + {1} = {2}")
    .exec(/{(\d+)(\:)?([^}]*)}/g);