What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [problem] Buttons in windows

[problem] Buttons in windows
Author: Message:
markee
Veteran Member
*****

Avatar

Posts: 1621
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: [problem] Buttons in windows
Wow that's really stupid and makes me love regular expressions even more. Especially the fact that they use the string as the object and find macthes withing it.  Though I must admit that it then does get confusing trying to remember which way exec and replace go.... (or is it match.... there are too many different ways of doing things.

The way I do checks like this is as follows
code:
if((arr = RegExpObj.exec(stringObj)) !== null){
//put some code here
}
This way not only do I get the match, I get what exactly it matched and can get lots more iformation about the match (like rest ofthe string to the left or right and havig an array of all of the matches and other stuff).  I highly advise people to use this method instead.  If you don't use any symbols then you can still store all of your words in an array and what is better is that you can make sure that it is that word and not part of a word.
code:
var RegExpObj = new RegExp("\b("+arrayObj.join("|")+")\b");
or if you would prefer the word to be even in part of a word, like "hi" will be found in "this" for example with the following code (but not hte previous)
code:
var RegExpObj = new RegExp("("+arrayObj.join("|")+")");
Both of these can be really useful when coding something that the user might edit, you just need to remember the put a \ before any special symbols that will be used (eg "$", "^", ".", etc.).

This method would mean that you do not need the for statement but would just be using a regular expression in your if statemet instead.

I understand if this has just gone way over your head but other members like roflmao might find this useful for future scripts.
[Image: markee.png]
10-25-2007 12:14 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[problem] Buttons in windows - by waynewilson2 on 10-22-2007 at 08:40 PM
RE: [problem] Buttons in windows - by roflmao456 on 10-22-2007 at 09:41 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-22-2007 at 11:01 PM
RE: [problem] Buttons in windows - by Spunky on 10-22-2007 at 11:22 PM
RE: [problem] Buttons in windows - by roflmao456 on 10-23-2007 at 12:51 AM
RE: [problem] Buttons in windows - by waynewilson2 on 10-23-2007 at 05:29 AM
RE: [problem] Buttons in windows - by roflmao456 on 10-23-2007 at 08:13 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-23-2007 at 08:16 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-23-2007 at 08:49 PM
RE: [problem] Buttons in windows - by NanaFreak on 10-23-2007 at 08:54 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-23-2007 at 08:55 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-23-2007 at 09:02 PM
RE: [problem] Buttons in windows - by roflmao456 on 10-23-2007 at 09:36 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-23-2007 at 09:44 PM
RE: [problem] Buttons in windows - by Spunky on 10-23-2007 at 10:12 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-24-2007 at 05:13 AM
RE: [problem] Buttons in windows - by Spunky on 10-24-2007 at 11:17 AM
RE: [problem] Buttons in windows - by markee on 10-24-2007 at 11:25 AM
RE: [problem] Buttons in windows - by Spunky on 10-24-2007 at 12:47 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-24-2007 at 08:19 PM
RE: [problem] Buttons in windows - by NanaFreak on 10-24-2007 at 08:50 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-24-2007 at 10:41 PM
RE: [problem] Buttons in windows - by roflmao456 on 10-24-2007 at 10:54 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-24-2007 at 10:56 PM
RE: [problem] Buttons in windows - by roflmao456 on 10-24-2007 at 11:06 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-25-2007 at 01:23 AM
RE: [problem] Buttons in windows - by markee on 10-25-2007 at 12:14 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-25-2007 at 08:42 PM
RE: [problem] Buttons in windows - by markee on 10-25-2007 at 11:21 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-26-2007 at 02:32 AM
RE: [problem] Buttons in windows - by waynewilson2 on 10-26-2007 at 05:25 AM
RE: [problem] Buttons in windows - by markee on 10-26-2007 at 07:03 AM
RE: [problem] Buttons in windows - by waynewilson2 on 10-26-2007 at 09:11 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-26-2007 at 10:18 PM
RE: [problem] Buttons in windows - by roflmao456 on 10-26-2007 at 10:28 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-26-2007 at 10:39 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-26-2007 at 11:01 PM
RE: [problem] Buttons in windows - by roflmao456 on 10-26-2007 at 11:46 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-27-2007 at 05:27 PM
RE: [problem] Buttons in windows - by roflmao456 on 10-28-2007 at 05:25 PM
RE: [problem] Buttons in windows - by waynewilson2 on 10-29-2007 at 12:25 AM
RE: [problem] Buttons in windows - by waynewilson2 on 10-29-2007 at 02:02 AM
RE: [problem] Buttons in windows - by roflmao456 on 10-29-2007 at 02:43 AM
RE: [problem] Buttons in windows - by waynewilson2 on 10-29-2007 at 03:02 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