What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Help]Returning the inside of a string...

[Help]Returning the inside of a string...
Author: Message:
Pai
Full Member
***

w00t !

Posts: 203
Reputation: 2
– / Male / –
Joined: Sep 2003
RE: RE: [Help]Returning the inside of a string...
quote:
code:
/* text is an array
text[0] will contain the full matched string eg [b]moo[/b]
text[1] will contain the first match eg moo

if there was another match it would be in text[2] and so on...
*/



That would be correct if we were using PHP (preg), but doesn't apply to JScript ... text only contains a string with the matched expression ([b]moo[/b] in this case), and not an array with the matches :S

Test case:
code:
var Message = "this is just a [b]test[/b] string that doesnt make [u] any sense [/u] ..";
var text = Message.match(/\[b\](.*?)\[\/b\](.*?)\[u\](.*?)\[\/u\]/g);

Result:
  text[0] or text: [b]test[/b] string that doesnt make [u] any sense [/u]
text[1,2,3,...,N]: null

07-13-2006 08:32 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Help]Returning the inside of a string... - by andrewdodd13 on 07-12-2006 at 05:11 PM
RE: [Help]Returning the inside of a string... - by Pai on 07-12-2006 at 06:01 PM
RE: [Help]Returning the inside of a string... - by -dt- on 07-13-2006 at 03:13 AM
RE: RE: [Help]Returning the inside of a string... - by Pai on 07-13-2006 at 08:32 AM
RE: [Help]Returning the inside of a string... - by Silentdragon on 07-13-2006 at 09:56 AM
RE: [Help]Returning the inside of a string... - by -dt- on 07-13-2006 at 10:07 AM
RE: [Help]Returning the inside of a string... - by Pai on 07-13-2006 at 11:21 AM
RE: [Help]Returning the inside of a string... - by andrewdodd13 on 07-13-2006 at 11:33 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