Regular Expressions

Don't have 100 hours, or answered your question yourself? Ask for help and post your answers here!
Post Reply
User avatar
Tally M.
Posts: 868
Joined: Thu Dec 27, 2012 6:05 pm
Location: BYU

Regular Expressions

Post by Tally M. »

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...
S.A.M.
Posts: 444
Joined: Mon Jul 09, 2012 11:30 am
Location: Alaska

Re: Regular Expressions

Post by S.A.M. »

Don't know if you are still looking, but try this:

[^A-Z][!.?"')] {1,2}[[A-Z]
User avatar
Tally M.
Posts: 868
Joined: Thu Dec 27, 2012 6:05 pm
Location: BYU

Re: Regular Expressions

Post by Tally M. »

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.
S.A.M.
Posts: 444
Joined: Mon Jul 09, 2012 11:30 am
Location: Alaska

Re: Regular Expressions

Post by S.A.M. »

[^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!
Post Reply