mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Nov 2003
Posts: 101
C
colt45 Offline OP
Vogon poet
OP Offline
Vogon poet
C
Joined: Nov 2003
Posts: 101
Code looks right to me, but what I can't figure out why it's not working for me?

Code:
if ($regex([Ss]?)(\d{1,2})([xXeE\.\-])(\d{1,2}) isin $1-) {
  //echo -a TV Show Detected : $1-
}


Quote:
* Invalid parameters: $regex


I've been trying various ways to get it to work but no luck since last night - right now i'm having a bit of a headache! - lol
I possibly have a dementia - coding is like way past my time frown

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
You have matching count of open/close parenthesis but they're mis-matched, so the $regex ends right after the question. Also, after you fix that, if $1- contains color codes which are not part of a wildcard string you may need to use $strip($1-)

Joined: Nov 2003
Posts: 101
C
colt45 Offline OP
Vogon poet
OP Offline
Vogon poet
C
Joined: Nov 2003
Posts: 101
Can you give me an example of what it should be?
As my english is not good so I'm struggle to understand your answer frown

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
I added parenthesis in a way which pairs them logically. Whether this is the correct regex depends on what your input string looks like. I got it to match like:

Code:
//tokenize 32 test12-34 | if ($regex($strip($1-),([Ss]?)(\d{1,2})([xXeE\.\-])(\d{1,2}))) echo -a $1- returns $v1 / $regml(1) / $regml(2) / $regml(3) / $regml(4)


Joined: Nov 2003
Posts: 101
C
colt45 Offline OP
Vogon poet
OP Offline
Vogon poet
C
Joined: Nov 2003
Posts: 101
The line would shows anywhere in the line something like this
Quote:
Coronation.Street.S59E08.720p
or sometimes very rare, it shows
Quote:
Coronation.Street.59x08.720p

It could be in the 2nd word of the line .. or in the 7th word in the line - So this is why I want it to detect a SERIES/SOAP by reading the line with S**E** or **x** .. then keep a log of it by echo'in back into my @Windows.

I've tried your code, doesn't really do anything? Except it's flooding me with this
Quote:
test12-34 returns 1 / / 12 / - / 34


Thanks

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
My code wasn't a replacement for your ON TEXT event, it created $1- to test the match. Regex returns 0 if no match, so the 1 indicates a match.

//tokenize 32 Coronation.Street.S59E08.720p | if ($regex($strip($1-),([Ss]?)(\d{1,2})([xXeE\.\-])(\d{1,2}))) echo -a $1- returns $v1 / $regml(1) / $regml(2) / $regml(3) / $regml(4)

shows: Coronation.Street.S59E08.720p returns 1 / S / 59 / E / 08

The '1' means regex found a match. The next 4 strings are the matches for the 4 groups inside parenthesis. ([Ss]?) matched the S and (\d{1,2}) matched the 59 etc. Those are just helpful in debugging why it matches things it should not. Your event would just have something like:

Code:
on *:TEXT:*:#channelname:{
  if ($regex($strip($1-),([Ss]?)(\d{1,2})([xXeE\.\-])(\d{1,2}))) aline @windowname Match Regex Found in $chan : $nick $1-
}

Joined: Nov 2003
Posts: 101
C
colt45 Offline OP
Vogon poet
OP Offline
Vogon poet
C
Joined: Nov 2003
Posts: 101
Seems to work!! laugh
Many thanks - will keep the original code backed up .. now I need to tweak few things around and test further myself .. but your code does it for me nicely smile

Thanks

Joined: Nov 2003
Posts: 101
C
colt45 Offline OP
Vogon poet
OP Offline
Vogon poet
C
Joined: Nov 2003
Posts: 101
I've another questions if you don't mind me asking...

Code:
if ($regex($strip($1-),([\.\-\_\$chr(32)])(German)/i)) {
     //echo @Non-English Non-English : $strip($1-)
}


Because from time to time, I noticed sometimes it has a space in it and it wouldn't detects it. - I'm guessing regex doesn't like $chr(32) ?

Also, sometimes german doesn't picks up cos sometimes it filtered as German (Cap Case) .. I've tried adding /i or \i in the end of the regex line but appears it's not doing anything for me.

Hope for answer smile

Thanks


Link Copied to Clipboard