mIRC Home    About    Download    Register    News    Help

Print Thread
#23565 10/05/03 09:20 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
i have a problem with $regex,
$regex(#blah,\b#blah\b) returns 0 and it shouldn't becuz
$regex(blah,\bblah\b) returns 1, i think there is a problem when putting a "#" does any1 know what's the problem??

#23566 10/05/03 10:20 PM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
"#" is NOT a 'word' char, so in effect it IS a boundary. Use /(^|\s)#blah\b/

#23567 10/05/03 10:30 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
kthx
hmm can u tell me what is a word char ?
and what is IS smile ?

#23568 10/05/03 10:42 PM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
A "word" char is a letter, digit or underscore.

"IS" is an uppercase "is" , the present tense of "was", you know? laugh

#23569 10/05/03 10:47 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
hehe smile
what's underscore ??

#23570 10/05/03 10:48 PM
Joined: Dec 2002
Posts: 3,138
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
_ <-- That's an underscore

#23571 10/05/03 10:56 PM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
gotcha
10x smile

#23572 11/05/03 12:53 AM
Joined: May 2003
Posts: 730
S
ScatMan Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: May 2003
Posts: 730
hmm, another thing,
can u explain me better about the \b becuz i can't figure out how it works?



#23573 11/05/03 01:30 AM
Joined: Dec 2002
Posts: 699
N
Fjord artisan
Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 699
Straight from PCRE man page

\b word boundary
\B not a word boundary
\A start of subject (independent of multiline mode)
\Z end of subject or newline at end (independent of
multiline mode)
\z end of subject (independent of multiline mode)

These assertions may not appear in character classes (but
note that "\b" has a different meaning, namely the backspace
character, inside a character class).

A word boundary is a position in the subject string where
the current character and the previous character do not both
match \w or \W (i.e. one matches \w and the other matches
\W), or the start or end of the string if the first or last
character matches \w, respectively.


Link Copied to Clipboard