Regex and Replace

Jan 30, 2010
21
0
#1
Appreciate any help with getting @REGEX to work with @REPLACE.
I have a large file and I want to convert all whitespace to commas
I can use set bb=%@replace[^ ,^,,%bb]
gets rid of the biggest problem but there are lots of other spaces so I need to integrate regex with a replace.
echo set vt %@REGEX[[ \t]+|[ \t], %bb]
returns '1' but thats pretty useless information.
I can do this with RegexBuddy but hoped to discover a method of using regex in TCC.
 
#2
On Wed, 10 Feb 2010 06:26:17 -0500, bravotango <> wrote:

|Appreciate any help with getting @REGEX to work with @REPLACE.
|I have a large file and I want to convert all whitespace to commas
|I can use set bb=%@replace[^ ,^,,%bb]
|gets rid of the biggest problem but there are lots of other spaces so I need to integrate regex with a replace.
|echo set vt %@REGEX[[ \t]+|[ \t], %bb]
|returns '1' but thats pretty useless information.
|I can do this with RegexBuddy but hoped to discover a method of using regex in TCC.

@XREPLACE in my 4UTILS plugin may help you. Here's a small example.

v:\> echo %@xreplace["[ \t]*",^c,My dog has fleas.]
My,dog,has,fleas.
--
- Vince
 
#3
Vince: ftp://lucky.syr.edu/4plugins/vc9/sysutils.zip appears to have os.txt
inside and not sysutils.txt inside. Is that intended?

On Wed, Feb 10, 2010 at 6:45 AM, vefatica <> wrote:


> On Wed, 10 Feb 2010 06:26:17 -0500, bravotango <> wrote:
>
> |Appreciate any help with getting @REGEX to work with @REPLACE.
> |I have a large file and I want to convert all whitespace to commas
> |I can use set bb=%@replace[^ ,^,,%bb]
> |gets rid of the biggest problem but there are lots of other spaces so I
> need to integrate regex with a replace.
> |echo set vt %@REGEX[[ \t]+|[ \t], %bb]
> |returns '1' but thats pretty useless information.
> |I can do this with RegexBuddy but hoped to discover a method of using
> regex in TCC.
>
> @XREPLACE in my 4UTILS plugin may help you. Here's a small example.
>
> v:\> echo %@xreplace["[ \t]*",^c,My dog has fleas.]
> My,dog,has,fleas.
> --
> - Vince
>
>
>
>
>


--
Jim Cook
2010 Sundays: 4/4, 6/6, 8/8, 10/10, 12/12 and 5/9, 9/5, 7/11, 11/7.
Next year they're Monday.
 
#4
On Wed, 10 Feb 2010 11:18:14 -0500, Jim Cook <> wrote:

|Vince: ftp://lucky.syr.edu/4plugins/vc9/sysutils.zip appears to have os.txt
|inside and not sysutils.txt inside. Is that intended?

Obviously not. I fixed it.
--
- Vince
 
Jan 30, 2010
21
0
#5
Thanks Vince. That looks more like what's needed. Took me all day to find the latest version or 4utils plugin but your example works.
However if I change it to read my string:
echo %@xreplace["[ \t]*",^c,%bb]
I get error 'Parameter incorrect'
 
#6
On Thu, 11 Feb 2010 00:18:54 -0500, bravotango <> wrote:

|Thanks Vince. That looks more like what's needed. Took me all day to find the latest version or 4utils plugin but your example works.
|However if I change it to read my string:
|echo %@xreplace["[ \t]*",^c,%bb]
|I get error 'Parameter incorrect'

You can always find the newest at ftp://lucky.syr.edu/4plugins/vc9.

There may be problematic characters in %bb (or maybe it's empty). I find no
problem using a variable in the third parameter.

v:\> set zz=My dog has^tfleas.

v:\> set zz
My dog has fleas.

v:\> echo %@xreplace["[ \t]*",^c,%zz]
My,dog,has,fleas.
--
- Vince