View Single Post
  #2   Report Post  
Greg
 
Posts: n/a
Default

dk,

I don't know how or if this could be done in a single pass and a better way
may come along. Your example is not the best. I am assuming that you have
mulitple lines something like this

Mr Joe Jones 123 Miller St Boston MA 12345
Mrs Ann Smith 345 Park Ave Boston MA 12345
etc.

This could be done in multiple passes.

First make the street address stand out from the rest of the text.
Highlighting is one way to do this.

Using wildcards find: [0-9]*Ave
Replace with ^& - Now with the cursor still in the replace field, click
format highlight.

Relace all

You will have to repeat a similar process for St, Blvd, Lane, Place, Court,
etc. If you use Ave. Rd. St. Blvd. Ct. etc, the you could just use [0-9]*.

OK, next we want to replace spaces that are not highlighted with commas.
You don't need wildcards for this bit. With the cursor in the find field
type a single space, click FormatHighlight and Format Highlight. You should
see "Not Highlight" displayed under the field field. In the Replace field
type a comma and use FormatHighlight to clear the Hightlight formatting from
under the replace with window. Click replace all.

Next you want to remove hightlighing. Click in the find fiedl and remove
the space. Click FormatHightlight to display Highlighted under the find
field. Click in the replace window and clear all content. Click
FormatHighlight to display Not highligthed below the replace with field.
Click replace all.

HTH.

"dk" wrote:

We have a document that we want to replace all spaces to commas,but 1
exception that the space which is before the word Ave or St and also the 1
word prior to those words shall also not be replaced ex: mr,John,Doe,123 45
St,Boston,MA,10234
how can we do that using wildcards etc.?