Thanks Michael. It works perfectly, and it seems so easy, now that I see your formula.
Sure appreciate your help.
Thanks for your reply Obi-Wan. I tested your GREP solution as well, and it also worked as expected.
Both your solution and Michael's solution behave the same (at least for my particular needs).
I'm eager to better understand GREP, so perhaps you could elaborate on why you feel your answer is correct, yet Michael's is not?
1 person found this helpful
Of course, Michael's code seems to work because his way is just enough in your case but, as I show, his code includes the "space" after the two words if no number (+ a space before) after them!
It could be problematic if you really need to find these two words and only them!
For instance, to make an index. In this case, the entry would include this "space"
If you wanna play with Grep, keep in mind that you'll need to be "precise"!
In any case, by accepting it, be aware of your "vagueness" and its possible consequences!
Another writing [I like!]:
Vagueness is kind of nice; you should try it sometime!
Obi-wan, in your GREP, I am not familiar with \H+. Does that mean "anything NOT a horizontal space one or more times", effectively a word? And what does h(?1) mean? Does that mean ONLY one space? And what does the third grouping mean?
To be really precise, we would use this:
What does it mean?
--> Beginning of para
--> any group of letters (no space, no number) -- see below why this writing is better!
--> horizontal space (12 kinds of space + tab)
--> that means the same kind of group (delimited by parenthesis) than the first one, so: ([\u\l]+)
--> interesting writing: '(?> … )' is an "unbreakable" entity! with the "?" behind it, we means: "exist or not".
the targetted unbreakable group is: '\h\d+'
Using this code will avoid the problem you have with your code.
So, my code has 4 parts: a word + a space + a word (+ in option: a space + a number)
Using ([\u\l]+) will avoid to take in account: "Director 2" at a para beginning.
I like precision but, I repeat, your code could be enough here!
Obi-wan, thank you for that instruction. I feel a bit smarter, now. My Vague-O-Meter needle has swung a bit to the right!
Obi-wan, thanks for the detailed breakdown and explanation. We all appreciate your "precision" and expertise.