+ 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!
2 Answers
+ 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
+ 2
Thank you sm Roland Roland !