package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`(?m)(?:(:\n\s))(?:\s|\n|(?:.(?!modern))*)*`)
var str = `js/modern/redux/actions/open-file-in-new-window.js:
8 import { openWindow, maybeSetVariantRedirectDomainQueryParam } from '@slack/infra/multi-window';
9: import getPrimaryView from '@slack/redux/stores/workspace-store/get-primary-view';
10 import { isGovSlack } from '@slack/utility/is-gov-slack';
26 const teamId = getTeamId(team);
27: const conversationId = getPrimaryView(state);
28 let fileUrl = teamId
js/modern/redux/actions/open-shortcuts-menu.js:
10 import looksLikeChannelId from '@slack/utility/looks-like-channel-id';
11: import getPrimaryView from '@slack/redux/stores/workspace-store/get-primary-view';
12 import jumpToMessage from '@slack/redux/actions/jump-to-message';
25 const state = getState();
26: const primaryViewId = getPrimaryView(state);
27 `
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/