mIRC Home    About    Download    Register    News    Help

Print Thread
#62702 03/12/03 08:28 AM
Joined: Dec 2003
Posts: 2
B
Bowl of petunias
OP Offline
Bowl of petunias
B
Joined: Dec 2003
Posts: 2
Okay. This is a bit of code that I'm trying to get to work to strip out all characters not a-zA-Z. It should be working, as it has worked with the true perl regex lib, but it's not. Does mIRC somehow modify this libary?

Anyway, how can I get this to work?

%var = $regsub(cleantext, the11, [^a-zA-Z], , %b)

%b SHOULD contain "the", but it contains "the1". o_O

#62703 03/12/03 08:52 AM
Joined: Nov 2003
Posts: 227
H
Fjord artisan
Offline
Fjord artisan
H
Joined: Nov 2003
Posts: 227
what do you get if you type:

//var %b | .echo -q $regsub(cleantext,the11,/[^a-zA-Z]/g,,%b)| echo -a %b

#62704 03/12/03 09:20 AM
Joined: Apr 2003
Posts: 10
J
Pikka bird
Offline
Pikka bird
J
Joined: Apr 2003
Posts: 10
Yeah, that gives the desired result.
Blue and I were working on the same filter, figured I could respond on his behalf.
Still baffled as to why the original line only strips one character per token, but that doesn't matter much as long as there's a workaround. Thanks!

#62705 03/12/03 01:04 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
It's because $regsub() doesn't make patterns global by default, so unless you specify the g modifier the pattern will stop after it's first match.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#62706 03/12/03 01:46 PM
Joined: Dec 2003
Posts: 2
B
Bowl of petunias
OP Offline
Bowl of petunias
B
Joined: Dec 2003
Posts: 2
Ahhah. Never knew that. Well, thanks everyone.


Link Copied to Clipboard