A small hack can help: add someting at the beginning of the Reader (with io.MultiReader) that won't allow the match on the beginning.
2018. április 9., hétfő 6:48:10 UTC+2 időpontban Paul Lalonde a következőt írta: > > A ^ normally matches either the start of string or the start of a new line > (with the m flag). > I'd like to match only starts of lines, but not starts of strings, ideally > without changing the regexp. > > My source data is in a ReadSeeker, and if I use > Regexp.FindReaderSubmatchIndex() I can get the first match - always the > start of string - and then Seek back to the end of that match to get the > next match. Sadly, that one also then matches start-of-string, and there's > no hope of finding my start of line locations. > > On a string or []rune I'd ask for FindAll and get a long list of my line > starts, but on a Reader it seems I'm hooped, as there is no All version. > > Any advice? My reader comes from a fairly complex data structure that can > be read in blocks - I was hoping to avoid managing expressions that might > span blocks by putting the data through a Reader interface. Is there a > better way? > > Thanks, > Paul > -- 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. For more options, visit https://groups.google.com/d/optout.