Anyone here familiar with regular expressions?
I'm trying to do this exercise and I can't seem to figure out how to mark only the end of sentences.
I've tried putting .[\.?!)"']+\s[A-Z] in, but that's not working...
Regular Expressions
Re: Regular Expressions
Don't know if you are still looking, but try this:
[^A-Z][!.?"')] {1,2}[[A-Z]
[^A-Z][!.?"')] {1,2}[[A-Z]
Re: Regular Expressions
Thanks a ton! I was starting to think no one here did that kind of stuff =P Now to try to figure out exactly what it's doing.
Re: Regular Expressions
[^A-Z] - any character except capital A thru Z
[!.?"')] - matches any one of these characters
{1,2} - must have at least on space, and not more than two (the character, a space, before the {} is important)
[A-Z] - matches any capital A thru Z, there is an extra start bracket in here, dump that, sorry (not [[A-Z])
should look like this then: [^A-Z][!.?"')] {1,2}[A-Z]
In a sentence:
Any character that is not a capital followed by !,.,?,", or ' and one or two spaces that are then followed by a capital letter.
Phew!
[!.?"')] - matches any one of these characters
{1,2} - must have at least on space, and not more than two (the character, a space, before the {} is important)
[A-Z] - matches any capital A thru Z, there is an extra start bracket in here, dump that, sorry (not [[A-Z])
should look like this then: [^A-Z][!.?"')] {1,2}[A-Z]
In a sentence:
Any character that is not a capital followed by !,.,?,", or ' and one or two spaces that are then followed by a capital letter.
Phew!