RegEx to Match Sentence -- Works in RegEx101.com but not KM


#1

Why doesn't this work in KM?

RegEx101.com Match Sentence
([A-Z].+?(?=(?:\. {1,2}[A-Z])|[\.?!]$)[\.?!])

KM match stops at first period:
Here is a sentence with abbrev.

RegEx101.com Results

image


MACRO:   RegEx to Match Sentence

~~~ VER: 1.0    2019-02-16 ~~~

DOWNLOAD:

RegEx to Match Sentence.kmmacros (5.4 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


image


#2

Your regex depends on case but you've set the action to ignore case.


#3

Bingo! :+1:
I can't believe I made such a rookie mistake. :blush:
The RegEx and macro now work perfectly.

I have made some minor updates to the RegEx:
RegEx101.com Extract Sentence from Paragraph
([A-Z].+?(?=(?:[\.?!]\h+[A-Z])|[\.?!]$)[\.?!])

Thanks again @mrpasini.

Here's my finished Macro for Pages based on this:
MACRO: Pages -- Select Sentence [Example]


#4

Happy I was able to help!