Created
July 12, 2022 16:21
-
-
Save creative-cranels/4a50c3e924caebc28763cab02707770f to your computer and use it in GitHub Desktop.
Sample file for Urziya
This file contains hidden or 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" | |
) | |
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