View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default extract text from string, leaving numbers and operators

On Wed, 25 Feb 2009 13:20:10 -0800, CEG wrote:

I figured a workaround for the decimal vs period problem. However, I do have
one other issue…is there a way to extract any 7-digit numbers? Sometimes
there is a reference number used that does not belong in the calculation.


Yes there is.

Some examples would be useful, but, in general, you should be able to just add
to Pattern and argument representing seven digits in a row.

Is the reference number separated from the rest of the string by a <space?

You could use something like the pattern below:

"(=.*)|[^-\d+*/^.]|(\b\d{7}\b)"

Please note that I also removed the "=" sign from the list of things to retain,
and chose to delete the "=" and everything that follows it. This may or may
not make a difference, but did in one of your examples where you had an "="
sign.
--ron