mIRC Home    About    Download    Register    News    Help

Print Thread
#38599 27/07/03 04:25 PM
Joined: Feb 2003
Posts: 309
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309
Now it's entirely possible to script, but could turn out to be a bit bothersome; but I think I could find being able to tokenize something by a regexp would be handy-dandy.

SURE you may say we have it already; but thats in 3 or 4 lines of code and testing. I just don't have the finger muscles to type that much.

/tokenize -r <regexp> <text>

#38600 27/07/03 05:06 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Not 100% sure what that would do. Something like turn \1 \2 \3 into $1 $2 $3? ie, all the backreferences become identifiers?

#38601 28/07/03 09:49 AM
Joined: Feb 2003
Posts: 309
C
Fjord artisan
OP Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309
Its more of a nicety than anything else:

It'd provide similar functionality to preg_split() as used in PHP
http://au.php.net/manual/en/function.preg-split.php

*repastes a tiny bit for the lazy*
array preg_split ( string pattern, string subject [, int limit [, int flags]])

Returns an array containing substrings of subject split along boundaries matched by pattern.


#38602 28/07/03 03:41 PM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Ah, then yeah, that would be useful to have. Although, mIRC will force some of the nice features (such as the offset of each token) to be lost...

#38603 04/08/03 12:04 AM
Joined: Aug 2003
Posts: 17
C
Pikka bird
Offline
Pikka bird
C
Joined: Aug 2003
Posts: 17
regex is taken from perl..if perl doesnt support that then regex on mIRC never will

#38604 04/08/03 02:36 AM
Joined: Dec 2002
Posts: 2,809
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 2,809
Umm no, you're totally wrong there. The regexp support in mIRC is taken from PCRE, not from Perl. The php function which was mentioned is based on PCRE. Therefore, it should be 100% possible for this to be added in mIRC. And anyway, the fact that it is not internally supported by PCRE doesn't mean anything either. The code that is needed to handle this needs to be in mIRC, not in PCRE. Just like how mIRC can use a regexp in /filter, yet PCRE does not have a filter command.

#38605 04/08/03 07:48 AM
Joined: May 2003
Posts: 18
K
Pikka bird
Offline
Pikka bird
K
Joined: May 2003
Posts: 18
Quote:
if perl doesnt support that then regex on mIRC never will

Perl does support it

But really, who cares what Perl supports? Perl doesn't have a built-in function for searching an entire hash table with a regex, yet Mirc does ($hfind(...)). Perl is not Mirc, you can have stuff in Perl that you dont have in Mirc and vice versa.


Link Copied to Clipboard