preg_match('/^website: (.*) value="(.*)"/imU','website: sample.com
value="100"', $result)
$result[1] get the first (.*) => sample.com
$result[2] get the second (.*) => 100
Can I do the same thing with regexp ?
Thank you.
r := regexp.MustCompile(`^website: (.*) value="(.*)"$`)
result := r.FindAllStringSubmatch(`website: www.sample.com
value="100"`,1)
fmt.Printf("Result1: %s\n",result[0][1]) // www.sample.com
fmt.Printf("Result2: %s\n",result[0][2]) // 100
FindAllStringSubmatch detects ( ) and return value of parenthesis
Comments are welcome.