mIRC Home    About    Download    Register    News    Help

Print Thread
#10954 13/02/03 11:27 PM
Joined: Jan 2003
Posts: 94
S
Sabby Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Jan 2003
Posts: 94
I was wondering how could i replace everything in text exept the volews...

Example:

If i entered: Hello everyone
it would return: *e**o e*e**o*ne

And also is there an easier more suffient way of replacing all text and chrs with * in that... i cant just do $str(*,$len($1-)) because then it would be one line..


Thanks


-
E-Mail: mirc_sabby@hotmail.com
Network: irc.enterthegame.com
Channel: #Helpdesk
#10955 13/02/03 11:43 PM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
//tokenize 32 hello everyone | .!echo -q $regsub($1-,/[^aeiou\x20]/g,*,%a) | echo -a %a


edit--
Whhops, no var %a declared.. *slaps herself* blush

//tokenize 32 hello everyone | var %a | .!echo -q $regsub($1-,/[^aeiou\x20]/g,*,%a) | echo -a %a

Last edited by Nimue; 13/02/03 11:45 PM.
#10956 14/02/03 12:28 AM
Joined: Jan 2003
Posts: 94
S
Sabby Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Jan 2003
Posts: 94
would you mind explaining:
\x20]/g
and /[ at the begging?

i know ^ means begging of text..


-
E-Mail: mirc_sabby@hotmail.com
Network: irc.enterthegame.com
Channel: #Helpdesk
#10957 14/02/03 12:45 AM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
the expression is enclosed in / ... /
[<xxx>] is a class to match (in this case, aeiou)
[^<xxx>] is a class to NOT match
"g" means global (not just the first instance)
"\x" + up to two hexadecimal digits to match - \x20 = $chr(32)

For info on $regex, man.txt is very useful smile

#10958 14/02/03 01:32 AM
Joined: Jan 2003
Posts: 94
S
Sabby Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Jan 2003
Posts: 94
so i could do: $regsub($1-,/[a-zA-Z0-9\x20]/g,*,%a)

will replace everything?
ie: hello everyone = $1-
and it would return ***** ********


-
E-Mail: mirc_sabby@hotmail.com
Network: irc.enterthegame.com
Channel: #Helpdesk
#10959 14/02/03 01:36 AM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
Or: $regsub($1-,/\S/g,*,%a) smile

#10960 14/02/03 01:51 AM
Joined: Jan 2003
Posts: 94
S
Sabby Offline OP
Babel fish
OP Offline
Babel fish
S
Joined: Jan 2003
Posts: 94
wow.. regex is complicated.. i guess ill read through that tutorial

thanks so much Nimue


-
E-Mail: mirc_sabby@hotmail.com
Network: irc.enterthegame.com
Channel: #Helpdesk
#10961 14/02/03 01:57 AM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
It's not all that complicated really, once you know a litle, more becomes clearer. (like most new things) grin
The man.txt file is a great reference, but try a simple tutorial first smile

#10962 14/02/03 05:45 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
You can just use a literal space in the class, instead of \x20, and save 3 chars! smile


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#10963 15/02/03 07:44 PM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
Yeah $true, I know that, also \s, I just find \x format more readable in some cases. (Maybe i'm weird, but I care not) smile


Link Copied to Clipboard