Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A Very Newbie Question

Status
Not open for further replies.

MinHRoberts

IS-IT--Management
Apr 21, 2004
2
0
0
US
I'm very new to tcl and I'm trying to strip out any ','s that's embedded in a field. I'm using the regsub command and while testing it using the following, before putting it in my "real" script I keep getting this error...

set namer "john, smith"
> john, smith
regsub -all , " " $namer
> wrong # args: should be "regsub ?switches? exp string subSpec varName"

What ame I doing wrong?
Thanks for your help
Herman
 
Hi

Depends on version. For exemple in my 8.3 the fourth parameter is mandatory.
Code:
[blue]%[/blue] set namer "john, smith"
john, smith
[blue]%[/blue] regsub -all , $namer " " namer
1
[blue]%[/blue] puts $namer
john  smith
Note, that you used the parameters in wrong order.

Feherke.
 
Thanks feherke that was the problem, I needed that forth parameter. now Another question...

If I was using it in an array would it go like this;
set temp_str $temp_str\"[regsub -all , $rdata(cardholdername) "" cardholdername]\", .....or.....
set temp_str $temp_str\"[regsub -all , $rdata(cardholdername) "" rdata(cardholdername)]\",
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top