Forum Moderators: bakedjake

Message Too Old, No Replies

Regex to find all spaced initials

A. B., R. J., etc., for consistent editing

         

rjohara

11:38 pm on Jun 26, 2002 (gmt 0)

10+ Year Member



I use BBEdit on a Mac, and it is able to do grep searches using unix regular expressions (perhaps in its own special flavor). Mind you, I don't even really understand that last sentence I just typed, but I know that these mysterious unix tools are ways to search for complex character strings, and that's what I want to do.

Can someone tell me what I might need to put in the "search" box to find all examples of a pair of initials with a space between? Examples would be A. B., R. J., a. m., p. m., etc.: any two letters followed by a period and with a space between. I know I have been inconsistent across pages in typing A.B. vs. A. B., and now for obsessive-compulsive editorial reasons I'd like to regularize them.

I don't mind changing them by hand, so don't need a replace string; just a find string would be enough. Any suggested code snippet would be appreciated.

Many thanks.

ergophobe

12:56 am on Jun 27, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



A quick test verifies that this catches the case you describe. It should also catch A.[tab]B. but I trust that isn't problem.

[a-zA-Z]\.\s[a-zA-Z]\.

If you use parens, you should be able to do a search and replace

([a-zA-Z]\.)\s([a-zA-Z]\.) $1$2

should give you no spaces

rjohara

11:34 pm on Jun 30, 2002 (gmt 0)

10+ Year Member



Worked like a charm - thank you, ergophobe!