Created
February 11, 2013 08:21
-
-
Save GeertJohan/4753228 to your computer and use it in GitHub Desktop.
block-quotes code regexp for SGR (github.com/foize/go.sgr)
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
Regexp: `(?:(?:^\[?\[([a-zA-Z0-9\- ]+)\])|([.\n\r]+))*` | |
Input: "[red] blabla [[ escaped? [bla-fd] ]] escaped?" | |
Output(fmt %#v): []string{"[red]", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""} | |
Expected: []string{"[red]", " blabla [[ escaped? ", "[bla-fd]", " ]] escaped?"} | |
Regexp: \[([^\]]+)\] | |
Input: "[red] blabla [[ escaped? [bla-fd] ]] escaped?" | |
Output(fmt %#v): [][]int{[]int{0, 5}, []int{13, 33}} | |
Expected: [][]int{[]int{0,5}, []int{25, 8}} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment