Go (RE2)

Sentence Boundary in GO

Go (RE2) can't run this pattern out of the box.

Try it in the GO tester →

Why it doesn't work in GO

Go's RE2 engine doesn't support lookarounds (`(?=...)`, `(?<=...)`, etc.) — they break the linear-time matching guarantee.

Workaround

Restructure to capture the surrounding context as a group instead, or use JS / Python where lookarounds are available.

Pattern

regexGO
[.!?]\s+(?=[A-Z])   (flags: g)

How the pattern works

`[.!?]` matches terminating punctuation. `\s+` matches whitespace. `(?=[A-Z])` is a lookahead for a capital letter (marks where the next sentence begins).

Examples

Input

Hello world. How are you? I'm fine!

Matches

  • .
  • ?

Same pattern, other engines

← Back to Sentence Boundary overview (all engines)