Created
June 23, 2020 08:28
-
-
Save bayucandra/3d8e3862dc6b54a56afe4d132552cea2 to your computer and use it in GitHub Desktop.
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 | |
//https://play.golang.org/p/_iu24fTdt57 | |
import ( | |
"fmt" | |
"regexp" | |
) | |
func main() { | |
str := `an..19` //https://en.wikipedia.org/wiki/ISO_8583#Examples_3 | |
r := regexp.MustCompile(`^([a-z]+)(\.+)?([0-9]+)$`) | |
res := r.FindStringSubmatch(str) | |
dataType := res[1] | |
dataLengthNotation := res[2] | |
dataLength := res[3] | |
fmt.Println(" - dataType:", dataType, "\n - length notation:", dataLengthNotation, "\n - dataLength:", dataLength) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment