I have been trying this for several days and I am coming up empty. I am simply trying to match a phrase that contains "v." within it, surrounded by newlines and em or en dashes.

Plain english expression would be:

(NEWLINE or CARRIAGE RETURN) (any number of words) v. (any number of words) -

However, Word seems to find ALL matches, not the smallest match, so if I do something like this:

[^13^11]{1}?{1,} v. ?{1,}[^+^=]

I will get dozens if not hundreds of bad matches.

Here is some sample text to search on:

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

False Positive v. Other False Positive

Something v. Something - Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

Longer Name Co. v. Other Long Name Co. - Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

I want the search to match "Something v. Something" and "Longer Name Co. v. Other Long Name Co." and nothing else. I do not want to match "False Positive".

  • Using your regex (I added a regular hyphen to the m-dash and n-dash) and your sample text in Word 2007 I get exactly those matches and no false positives. What would be an example of a bad match in your sample text? – Dennis Williamson Sep 9 '10 at 4:30
  • Edited to include a possible false positive. Does Word have an "exclude" for the caret+unicode characters? When I run the [!^13] to attempt to include all characters except newline, it ignores the caret+unicode form and excludes ^,1,3 – Andrew Sep 9 '10 at 15:53

I now see how false positives are behaving. Trying to exclude ^13 would seem to be the way to go, but I can't see any way to accomplish that.

I think that your need exceeds the capabilities of Word. It seems to have a very poor "wildcard search" which does not qualify to be called a regular expression search.

Out of curiosity, I tried your sample text in OpenOffice.org Writer and this regular expression seems to do exactly what you're looking for:

^.+ v. [^-–]+ [-–]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.