This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

regexp -all bad switch? why?

Old posts that have not been replied to for several years.
Locked
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

regexp -all bad switch? why?

Post by awyeah »

Hi,

I have some tcl problem.
The shell server I use has the following tcl versions

Code: Select all

[15:48] TCL Version: 8.2
[15:48] TCL Patchlevel: 8.2.3
I am using a script which utilizes regular expressions.
Using 'regexp -all'.

When I execute the script it says -all is a bad switch.
And use others such as -nocase, -indices and bla bla.

What can be the problem? The tcl version? It doesn't
support regexp -all.

When I simply use regexp without any switches it works
fine or with all other switches except -all. Even regular
substitions, regsub -all works fine... but why not regexp -all?

Does anyone know the answer, maybe?
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
d
dollar
Op
Posts: 178
Joined: Tue Oct 28, 2003 3:47 pm
Location: Netherlands

Post by dollar »

As the manual page for Tcl 8.2 indicates, it doesn't have a -all trigger (In Tcl 8.2, that is. Tcl 8.3 and up have it.).
dollar (or something similar) at:
#eggdrop / #tcl - undernet
#egghelp / #tcl / #eggtcl - efnet
#eggdrop.support / #tcl - quakenet
#eggdrop - ircnet
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Thanks... for letting me know.
I'll insist my admin to upgrade to the newer versions
as the regexp -all is quite a usefull and common command
and I need to use it in quite alot of my tcls 8)
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

you can always use string map ...
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

string map?

or did you mean

string match?

I am aware with what string match does (similar to regexp -all)
but have no idea of string map.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

i ment string map, you use it like this:

Code: Select all

set str [string map {"b" "B"} "abcd"]
and it'll replace the 'b' with a 'B'

thats doing the same as:

Code: Select all

regsub -all "b" "abcd" "B" str
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Oic... thanks again... I will look that up in the
manual as well.. good command to use to
so I can change regsub to string map.

regsub is slow and string manipulation
commands are fast as we know.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Didn't he wanted the regexp not regsub? :)
Once the game is over, the king and the pawn go back in the same box.
Locked