I'm trying to convert a couple of Python regular expressions into Go. The issue I'm having is the lack of support for lookahead assertions in Go.
How do I convert these two regular expressions into Go?
/*
Format of a regular expression to find contexts including possible
sentence boundaries. Matches token which the possible sentence boundary
ends, and matches the following token within a lookahead expression
*/
const periodContextFmt string = `
\S* # some word material
{{.SentEndChars}} # a potential sentence ending
(?=(?P<after_tok>
{{.NonWord}} # either other punctuation
|
\s+(?P<next_tok>\S+) # or whitespace and some other token
))`
// Format of a regular expression to split punctuation from words, excluding period.
const wordTokenFmt string = `(
{{.MultiChar}}
|
(?={{.WordStart}})\S+? # Accept word characters until end is found
(?= # Sequences marking a word's end
\s| # White-space
$| # End-of-string
{{.NonWord}}|{{.MultiChar}}| # Punctuation
,(?=$|\s|{{.NonWord}}|{{.MultiChar}}) # Comma if at end of word
)
|
\S
)`