I'm using the following code to find a substring using regex in Swift:
let searchString = "Please contact us at <a href=\"tel:8882223434\" ><font color=\"#003871\"><b> 888.222.3434 </b></font></a> for assistance"
let regexp = "^\\d+(\\.\\d+)*$"
if let range = searchString.range(of:regexp, options: .regularExpression) {
let result = searchString.substring(with:range)
print(result) // <---- not printing the resulting string
}
The desired output is 888.222.3434
Any help would be greatly appreciated. Thank you.