For the documentation of the RE2 regular expression dialect, see https://github.com/google/re2/wiki/Syntax
^ matches only at start of string, unless you set multi-line mode: https://go.dev/play/p/GCglWdjqEHq On Monday, 5 December 2022 at 12:10:20 UTC sbezv...@cisco.com wrote: > Hello, > > > > I came across a strange behavior in regular expression processing, please > see the following simple code which is supposed to match the second line of > data variable. > > > > https://go.dev/play/p/QPrNRuhCv8r > > > > The matching data starts at the beginning of the 3rd line so I expect the > pattern `^` + l + `\s+([0-9]+)\s+` would result in a match, but it does > not. If I remove `^` from the regular expression, then the match is found. > Running `grep -E` with regular expression which includes `^` also finds the > expected match. > > > > Appreciate some feedback. Is it a bug or I do something incorrectly? > > > > Thank you > > Serguei > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/809137c4-66c6-42b2-a30f-fa62e1883dadn%40googlegroups.com.