I'm trying to use something like the pattern "John.*Smith" but instead of matching anything in between John and Smith I'd like to match anything between the words as long as it's of X characters length or less.
If X = 5 for instance:
Lines that should be a match:
- John Smith
- Jonh F. Smith
Lines that shouldn't be a match:
- John Ferdinand Smith
- Joe Brown; John Johson; Mary Smith
How could I do that with grep?