Skip to content

Instantly share code, notes, and snippets.

@TomonoriSoejima
Created May 27, 2022 00:56
Show Gist options
  • Save TomonoriSoejima/87b18a512baa2fe1a6b476651633cbda to your computer and use it in GitHub Desktop.
Save TomonoriSoejima/87b18a512baa2fe1a6b476651633cbda to your computer and use it in GitHub Desktop.
regex.go.md
// You can edit this code!
// Click here and start typing.
package main

import (
	"fmt"
	"regexp"
)

func main() {

	var CloudTrailInsight = "AWSLogs/354381820582/CloudTrail-Insight/ap-northeast-1/2022/05/25/720170942685_CloudTrail-Insight_ap-northeast-1_20220225T0424Z_45rGnNQRfMVmXhRn.json.gz"
	matched, err := regexp.MatchString(`/CloudTrail-Insight/`, CloudTrailInsight)
	fmt.Println(matched) // true
	fmt.Println(err)

	var CloudTrail = "AWSLogs/354381820582/CloudTrail/ap-northeast-1/2022/05/25/354381820582_CloudTrail_ap-northeast-1_20220525T1000Z_hSy94Jdzpns6IMZV.json.gz"
	matched2, err2 := regexp.MatchString(`/CloudTrail/`, CloudTrail)
	fmt.Println(matched2) // true
	fmt.Println(err2)

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment