Created
November 20, 2019 21:05
-
-
Save vianhanif/7f2947867a02b380043ea28ffb592405 to your computer and use it in GitHub Desktop.
sample-go.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"regexp" | |
"strings" | |
) | |
func main() { | |
//mat3 := regexp.MustCompile(`[a-zA-Z0-9]`) | |
matched1 := regexp.MustCompile(`%%[a-zA-Z0-9]^\s') | |
matched2 := regexp.MustCompile(`[a-zA-Z0-9]%%`) | |
str := strings.ReplaceAll("%%buku%% and title %%code%%", "", "") | |
str = matched1.ReplaceAllString("%%buku%% and title %%code%%", `'%%`) | |
fmt.Println(str) | |
fmt.Println(matched2.ReplaceAllString(str, "%%'")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment