mIRC Home    About    Download    Register    News    Help

Print Thread
#92550 02/08/04 11:41 PM
Joined: Mar 2003
Posts: 8
S
Sinvi Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2003
Posts: 8
hello, i am wondering if anyone here can help me with this script. I am trying to make a script that will record the text inbetween two points. for example, if the two points were 'a' and 'ter' then "i am better then you"(just an example) would return "m bet" and "he was stern" would return "s s". i would also like to store the results in a file. on another note, is there anyway to stop the color determiners from appearing when you are copying and pasting? Thanks in advance

#92551 03/08/04 12:44 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hi,

been a while since I scripted anything, but here goes:

on *:TEXT:*:#channel: analyse $1-

alias analyse {
var %a = $regex($1-,/a(.+?)ter/gSi)
while %a { write myfile.txt $regml(%a) | dec %a }
}

When I performed the regex on: i am better then you but he was stern,
it returned "m bet" and "s s".

Change #channel to whatever channel you want this to scan. Note that It is perhaps not a good idea to keep writing to a file like that. You could write to a hidden window or to a hash table, and then save the results when closing irc or something.

As for your second question: do you mean you don't want the control codes when copy pasting something? Just don't hold ctrl when highlighting the text, and it won't copy the color codes.

Greets


Gone.
#92552 03/08/04 12:54 AM
Joined: Mar 2003
Posts: 8
S
Sinvi Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
S
Joined: Mar 2003
Posts: 8
thank you so much, exactly what i needed

#92553 03/08/04 01:07 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Most welcome.


Gone.
#92554 03/08/04 03:36 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Hi,

Added note:

/a(.+?)ter/

You can of course put anything you like there instead of "a" and "ter" (as you already knew) however there are a certain amount of characters that you cant use before escaping them. Without going into much detail, some characters like . ? + * etc. have a special meaning in a regular expression, so they need to be escaped. In other words if you wanted to get pieces of text that are in between: . and + you would have to escape them by putting a backslash \ in front of them. Some more chars have to be escaped, because of the way mirc's identifiers work.

This is a non-exhaustive list of characters that you should escape: . + ? * ( ) , [ ] ^ $ / \

Examples:

Between . and * --> / \.(.+?)\*/
Between + and ? --> /\+(.+?)\?/
Between ( and ) --> /\((.+?)\)/
Between [ and ] --> /\[(.+?)\]/
...

There a few possible solutions for your request, and the one I gave you is one of them. If you escape those special chars (if u should need them), then it will work fine.


Greets


Gone.

Link Copied to Clipboard