mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2016
Posts: 50
T
Babel fish
OP Offline
Babel fish
T
Joined: May 2016
Posts: 50
I want it to only run the code when a users types "!<commandname>" which works but there seems to be a problem when somebody types a message containing a "!" it triggers

ex: "Hi there!" would trigger the text event.

Code:
on $*:TEXT:m/\!.*/iS:#:{

code to run...

}


Any help would be appreciated!

Kind Regards
TillableToast


Life is potato.
Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
Add a ^ after the first /

^ indicates the beginning of the string

Joined: May 2016
Posts: 50
T
Babel fish
OP Offline
Babel fish
T
Joined: May 2016
Posts: 50
Thank you! It works perfectly now.
Do you know any good sites to learn about this?


Life is potato.
Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
This site is pretty good for trying out expressions or looking things up!

http://regexr.com/

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
To learn, http://www.regular-expressions.info/ is best, to try some pattern http://www.regex101.com is best


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard