Hi Guys,
Hopefully someone can help me with this tricky one.
I am currently maintaining some VBA code that formats a word document. One of the things it does is search for the people mentioned on each page and put the name of the last person mentioned on the page in the footer.
An example would be MR BLOGGS:
The current regex being used is "[A-Z -']{1,}:"
This also caters for MR O'REILLY: and MR ROSS-JONES:
Now they want me to cater for MR H. HOPPER: and the other variations of salutations and you would think it would be as simple as "[A-Z -'\.]{1,}:" but for some reason it does not work.
Here are some of the other variations I have tried and I admit, some of them are pretty poor:
"[A-Z]{1,}\.?[A-Z '-]{1,}:"
"[A-Z '-\.]{1,}:"
"[A-Z '-.]{1,}:"
"[A-Z '-]{1,}\.?[A-Z '-]{1,}:"
"[A-Z]?\.?[A-Z '-]{1,}:"
"[A-Z ]{1,}\.?[A-Z '-]{1,}:"
"[A-Z \x27\x2D\x2E]{1,}:"
"[A-Z -'`]{1,}:"
"[A-Z -'`]{1,}\x2e?[A-Z -'`]{1,}:"
"[A-Z\40\55\47]{1,}:"
"[A-Z(\40)(\55(\47)]{1,}:"
"[A-Z ]{4,}\.?[A-Z -']{1,}:"
Anyway, none of these work and so I really hope someone out there has a better idea.
Many thanks
Hopefully someone can help me with this tricky one.
I am currently maintaining some VBA code that formats a word document. One of the things it does is search for the people mentioned on each page and put the name of the last person mentioned on the page in the footer.
An example would be MR BLOGGS:
The current regex being used is "[A-Z -']{1,}:"
This also caters for MR O'REILLY: and MR ROSS-JONES:
Now they want me to cater for MR H. HOPPER: and the other variations of salutations and you would think it would be as simple as "[A-Z -'\.]{1,}:" but for some reason it does not work.
Here are some of the other variations I have tried and I admit, some of them are pretty poor:
"[A-Z]{1,}\.?[A-Z '-]{1,}:"
"[A-Z '-\.]{1,}:"
"[A-Z '-.]{1,}:"
"[A-Z '-]{1,}\.?[A-Z '-]{1,}:"
"[A-Z]?\.?[A-Z '-]{1,}:"
"[A-Z ]{1,}\.?[A-Z '-]{1,}:"
"[A-Z \x27\x2D\x2E]{1,}:"
"[A-Z -'`]{1,}:"
"[A-Z -'`]{1,}\x2e?[A-Z -'`]{1,}:"
"[A-Z\40\55\47]{1,}:"
"[A-Z(\40)(\55(\47)]{1,}:"
"[A-Z ]{4,}\.?[A-Z -']{1,}:"
Anyway, none of these work and so I really hope someone out there has a better idea.
Many thanks