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.
Old posts that have not been replied to for several years.
stammer
Voice
Posts: 31 Joined: Mon Mar 10, 2003 9:39 am
Location: Bulgaria
Post
by stammer » Wed Apr 20, 2005 3:23 am
Hi all,
i have string like this :
asfgghgfh45453*)_()([]{}!@#%^^%+-^#$#@35fsggdfg34534ASDEd45
my question is how to remove from it all except
alphabet characters --> a-z, A-Z
out string have to look like this :
asfgghgfhfsggdfgASDEd
Thanks alot.
P.S. Sorry for my bad English I'm from Bulgaria
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Wed Apr 20, 2005 8:19 am
take out an
ASCII table and put just all ranges of that chars you don't like within [] braces like [\000-\377].
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under
The MIT License
Love hurts, love strengthens...
greenbear
Owner
Posts: 733 Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway
Post
by greenbear » Wed Apr 20, 2005 12:05 pm
Code: Select all
regsub -all -nocase {[^a-z]} $string {} cleanstring
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Wed Apr 20, 2005 1:34 pm
Hmm, I somehow missread that [^...] thing in the manual, very intresting indeed
. in his example a much better solution
.
For example, assume the collating sequence includes a ch multi-character collating element. Then the RE [[.ch.]]*c (zero or more ch's followed by c) matches the first five characters of `chchcc'. Also, the RE [^c]b matches all of `chb' (because [^c] matches the multi-character ch).
confused me and made me ignore that:
If the list begins with `^', it matches any single character (but see below) not from the rest of the list.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under
The MIT License
Love hurts, love strengthens...
stammer
Voice
Posts: 31 Joined: Mon Mar 10, 2003 9:39 am
Location: Bulgaria
Post
by stammer » Thu Apr 21, 2005 6:18 am
Thanks alot to all
everything working ok...
Dedan
Master
Posts: 260 Joined: Wed Jul 09, 2003 10:50 pm
Location: Memphis
Post
by Dedan » Thu Apr 21, 2005 7:49 am
Code: Select all
regsub -all -- {[^A-z]} $text "" cleanstring
I once was an intelligent young man, now i am old and i can not remember who i was.
De Kus
Revered One
Posts: 1361 Joined: Sun Dec 15, 2002 11:41 am
Location: Germany
Post
by De Kus » Fri Apr 22, 2005 11:20 am
Dedan wrote: Code: Select all
regsub -all -- {[^A-z]} $text "" cleanstring
whats the sense of this? if you had looked at the posted ASCII table, you would know, that "A-z" and -nocase "a-z" are NOT the same.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under
The MIT License
Love hurts, love strengthens...