I'm trying to come up with a regex which would match the first sentence of the string. I don't need anything too complex, just a sentence that ends with ". " or "! " or "? " note the space after, so that the sentence "I need this domain.com! " would match. I didn't find anything on regexlib.com either. So far I'm stuck with this:
([^.|?|!]*)[\.\s\?\s\!\s]
It's not really working. If I try to match
"I need this domain.com! Another sentence. And another sentence."
I only get "I need this domain." and I need it to be "I need this domain.com!"
Try this :
^.*?[\.!\?](?:\s|$)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With