What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [ScriptingHelp] Match Whole Words Only

[ScriptingHelp] Match Whole Words Only
Author: Message:
garfieldman
New Member
*


Posts: 5
– / Male / –
Joined: Feb 2007
O.P. [ScriptingHelp] Match Whole Words Only
Any help for this amateur scripter will be much appreciated... :)

Kind of for practice, I'm testing a simple script where certain words in a message are automatically replaced by other words. (You know, just like the Quick Text function in Messenger Plus!)

So I got the replacing function down, but I can't seem to figure out, with my limited intelligence, how to make it so that it replaces whole words only.

so for example-
code:
function OnEvent_ChatWndSendMessage(ChatWnd, Message)
{
if (Message.search("Whatever") !== -1)
return Message.replace("Whatever","Test")
}

so now how do I make it so that the script only replaces "Whatever" with "Test" if "Whatever" is a whole word. Like, so "Whateverasfkl" wouldn't become "Testasfkl"? I've thought that perhaps it's using the split() string (Message.split(" "), but for all I'm worth I can't figure it out. :-/

This post was edited on 02-21-2007 at 12:57 AM by garfieldman.
02-21-2007 12:56 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[ScriptingHelp] Match Whole Words Only - by garfieldman on 02-21-2007 at 12:56 AM
RE: [ScriptingHelp] Match Whole Words Only - by CookieRevised on 02-21-2007 at 01:00 AM
RE: [ScriptingHelp] Match Whole Words Only - by garfieldman on 02-21-2007 at 01:04 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On