On Feb 19, 2010, at 6:57 PM, Glen Bojsza wrote:

I have a field which has hundreds of lines.

For all [ in the field I need to check to see if the character to it's
immediate left is a number.

If it is a number then the [ is to be converted into an _.

If it is not a number then the [ is to be removed (no substitution or
spaces).

I need to be able to cycle through the entire field which each line may
contain several [.

Any thoughts would be appreciated as I have tried using a combination of
find characters and foundchunk on the field without success.



assuming that the line cr char does not really matter
solution without RegEx

   put fld 1 into originalTextBlock
   set the linedel to "["
   repeat for each line LNN in originalTextBlock
      if word -1 of LNN is a number then
         put LNN & "_" after newVersion
      else
         put LNN  after newVersion
      end if
   end repeat
   set the linedel to cr
   -- see note below
   replace (cr & "_") with (cr & "[") in newVersion
   put newVersion into fld 2

-----------------------
Just in case there is a line ending in a number and the first char of the next line is '['
 and you did not want that specific conversion
 change is back to a '[' char

   replace (cr & "_") with (cr & "[") in newVersion

Brain dead + RegEx = disaster
I like and use RegEx, but know that you must be fresh to get it right in less than a fortnight :-)

Jim Ault
Las Vegas



_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to