SlickEdit Community
General => General Programming => Topic started by: afflictedd2 on April 22, 2008, 02:36:44 AM
-
Hi everyone,
I just made a macro to align a couple of columns for me.. however executing it 58000 times is kind of annoying... isn't there a way to specify it to execute this amount or.. to execute for the entire file :\
Thanks in advance.
Ed.
-
After a couple of tries I know now how to execute it n times. Anyway, the macro messes up when the columns are extremely sepparated, does anyone know a regular expression where I can replace and undetermined amount of whitespace between 2 numbers into a single space. The numbers can be digits from 0 to 9 there can be dots and negative signs, the thing that sepparates them is an undetermined amount of whitespace.
Thanks,
Ed.
-
\:d\:b+\:d
That is a digit followed by 0 or more whitespace characters followed by a digit
However if you want to use
([0-9\+\.\-]+)(\:b+)([0-9\+\.\-]+)?
That will match any group of at least one numbers, periods and plus or minus signs followed by any number of at least 1 whitespace followed again by any number of at least one number, period plus minus even none at all. However it would also match +-..9
However, I think you really mean more like this:
([\-\+]?[0-9]+(?:[\.]?+[0-9]+)?)\:b+
This means 0 or 1 of either a plus or minus sign, followed by at least 1 but as many as necessary digits, followed by 0 or 1 of period and at least 1 number ... that defines a number as long as you don't want comas.
Then
^((\:b*)(([\-\+]?[0-9]+([\.]?+[0-9]+)?)(\:b*)))+$
Matches a whole line. Starting with any number of white spaces followed by a number (like above) and any number of white space... the whole thing repeated over and over as many times as necessary.
Does that help?
As I read your message again I see it doesn't ... here is the replacement:
Search for this:
([\-\+]?[0-9]+(?:[\.]?+[0-9]+)?)(\:b+)([\-\+]?[0-9]+(?:[\.]?+[0-9]+)?)(\:b+)?
Replace with this:
\1 \3
Set Unix Regex on.