package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(Rs.|[$£€¥₹])?\s*(\d{1,3}(?:[, ]?\d{1,3})?(?:.\d+)?)(?(1)|\s*(kr\.?|Kč|INR|€))`)
var str = `The cost of this car with a 3.5 litre engine, is €2,927.100, or $3 271.32. In Sweden that would be around 27000kr. I would have to work overtime for 215 days to save the money for that, even though my job in the Czech Republic pays 436.5Kč an hour, and I can save 10% percent of that. My buddy in Japan, bought one for ¥357014.83
Rs. 2000 , Rs.2000 , Rs 20,000.00 ,20,000 INR 200.25 INR
It was just pointed out to me that in France, amounts are written with the Euro-sign post-fixed, like 2 927,10€ or 2 927.10€ or 2927,10€ or 2927.10€.`
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/