Hi Guys, I need help. Is there a way to identify a sentence that has only one word using regex?
Thanks in Advance.
This tutorial is very detailed: https://www.scirra.com/tutorials/1337/e ... onstruct-2
And this site may help you test your regex: https://regexr.com/
If you need something more specific, give us more details about it or share a capx that I'll be glad to take a look at it.
Hope this helps. Cheers!
Develop games in your browser. Powerful, performant & highly capable.
Ok, I should warn that I have zero experience with regex and this is my first ever regex pattern.
I was stunned when I got it right from the first attempt!
RegexMatchAt(text, "[.|!|?]\s+(\w+[.|!|?])", "i", 1)[/code:3imwggfy]
There is at least one problem with it - if the one-word sentence is in the beginning of the text, it won't be caught.
Also, it only searches for well-formatted sentences ending either with full stop, exclamation mark or question mark.
There may be other issues. But hey, I'm still proud!
brunopalermo dop2000, thanks alot guys. I will try them.