Skip to content

Instantly share code, notes, and snippets.

@creative-cranels
Created July 12, 2022 16:21
Show Gist options
  • Save creative-cranels/4a50c3e924caebc28763cab02707770f to your computer and use it in GitHub Desktop.
Save creative-cranels/4a50c3e924caebc28763cab02707770f to your computer and use it in GitHub Desktop.
Sample file for Urziya
package main
import (
"fmt"
"regexp"
)
func main() {
str := " -5 + 12 -3 "
numbersRG, _ := regexp.Compile(`[0-9]+`)
numbersList := numbersRG.FindAllString(str, -1)
fmt.Println("numbersList:", numbersList)
symbolsRG, _ := regexp.Compile(`[-+]`)
symbolsList := symbolsRG.FindAllString(str, -1)
fmt.Println("symbolsList:", symbolsList)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment