mIRC Home    About    Download    Register    News    Help

Print Thread
#24997 19/05/03 03:19 AM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
can any1 tell me what does //x in regex and if u can so //s too

#24998 19/05/03 07:27 AM
Joined: May 2003
Posts: 22
A
Ameglian cow
Offline
Ameglian cow
A
Joined: May 2003
Posts: 22
Check the numerous of regex tutorials that floats around on the internet.


--------------------------------------------------
I really don't know anything.... I just fake it
#24999 19/05/03 10:58 AM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
thank you, any1 else ??

#25000 19/05/03 11:10 AM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
//x makes regex ignore any whitespaces in the pattern. Example:
$regex(abc,/a b c/) -> 0
$regex(abc,/a b c/x) -> 1

//s makes the dot ( ".") match the LF character (char 10) too. By default, the dot matches every character except LF. Example:
$regex($lf,/./) -> 0
$regex($lf,/./s) -> 1

Seeing that most people vaguely recommend tutorials and stuff, I'd like to point out that it matters WHICH tutorial/manual you choose. mirc uses the PCRE library for regular expressions, so to learn all about mirc regex, one has to read the PCRE manual, not Perl/php/vbscript or whatever manual on regexes. For basic stuff, all these are ok, but your question is a good example of why the PCRE manual is necessary. Here it is


/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com
#25001 19/05/03 01:15 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
ok i will try to read him, and thx

#25002 19/05/03 01:23 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
hmm... but, why do i need to use //x if i can use:
$remove(...,$chr(32))


#25003 19/05/03 01:27 PM
A
Anonymous
Unregistered
Anonymous
Unregistered
A
uh huh

#25004 19/05/03 05:17 PM
Joined: Dec 2002
Posts: 169
J
Vogon poet
Offline
Vogon poet
J
Joined: Dec 2002
Posts: 169
It's there so you can make your pattern more readable. Why use $remove when you can smash it all together. I never use //x but then again I don't use $regex very often.

#25005 20/05/03 04:48 AM
Joined: Feb 2003
Posts: 309
C
Fjord artisan
Offline
Fjord artisan
C
Joined: Feb 2003
Posts: 309
because regex isn't a mIRC invention - other languages don't have a $remove that functions just like mIRC's, and it makes a more readable regex pattern (hello oxymoronville)

#25006 20/05/03 06:58 AM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
hmm, there is a problem in that, i found out that it removes other chars except space

#25007 21/05/03 02:22 AM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
It also removes (ignores) #comments (preceded by "#"), therefore will remove #channel along with #comment.


Link Copied to Clipboard