+ 1

Java regex

Hi everyone! I’m not that good with regex and I was wondering if it’s possible to capture the first letter of each sentence in a paragraph (after .|?|!). I already did it with StringBuilder and for loop with if else statement. But would love to see how it would turn out with regex. Thanks in advance!

9th Oct 2022, 8:36 AM
Loulou
2 odpowiedzi
+ 4
(?:^|(?:\.\s)|(?:\?\s)|(?:\!\s))(\w) \w = any lettre | = or ?:^ = start the sentence ?:\.\s = After . and Space ?:\!\s = After ! and Space ?:\?\s = After ? and Space https://rubular.com/r/OfDGF1iRKa1m5j
9th Oct 2022, 9:30 AM
Roland
Roland - avatar
+ 2
Thank you sm Roland Roland !
9th Oct 2022, 10:09 AM
Loulou