Skip to main content
deckarduk
Inspiring
January 10, 2025
Question

Catching an apostrophe with GREP - help required please

  • January 10, 2025
  • 2 replies
  • 737 views

Hi there,

 

I'm trying to catch words like we'll and you'll using GREP but as yet haven't succeeded. 

So far I have this...

 

 

(?i)\b(we’ll|you’ll)\b

 

 

This gets me pretty close but doesn't catch the whole word including the 'll.

Please can someone point me in the right direction.

Thanks

2 replies

Peter Spier
Community Expert
Community Expert
January 10, 2025

Works fine here in CS6, haven't tried newer versions.

Do you need to find specifally thoise two words, or are you looking fore a more general case of any word with apostrophe followed by two letters?

Peter Spier
Community Expert
Community Expert
January 10, 2025

Here's a general case:

[\u\l]+['~']\l{2}\b

It finds all the wods with apostrophes in this sentence: It’ll be awhile before we’ve finished and then you’ll see the result and we’ll get together when you're satisfied.

deckarduk
deckardukAuthor
Inspiring
January 10, 2025

Thanks for the help Peter, I'll run some tests 🙂

m1b
Community Expert
Community Expert
January 10, 2025

Here's one way:

 

\b(we|you)['’]ll\b

 

The square brackets match either typographical apostrophe or normal.

 

Edit: wait! I just tried your exact grep and it works as expected. How do you mean it doesn't catch the 'll?

Known Participant
January 10, 2025

Thanks for the help, works perfectly.

I added in the case-insensitive modifier too which takes it one step further.

 

Is there a way to modify the epression to include the words we and you too?

Can that all be done in one?

 

Thanks

m1b
Community Expert
Community Expert
January 10, 2025

To catch the words you and we also? Something like this:

(?i)\b(we|you)(['’]ll)?\b

I've put the apostrophe ell ell into a capture group to match zero or one instances. So it will match we and you whether there is ’ll or not.