What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Replacing "?"

Replacing "?"
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: Replacing "?"
quote:
Originally posted by Ezra
code:
stringObj.replace(/^(.+)(\?)$/i, \1..\2)

You forgot the "" around the second parameter. The first is a regular expression object and is totally correct, but the second is a string. Also, the regular expression can be lots and lots simpler. Therefore, the right way would be:
code:
stringObj.replace(/\?$/, "..?");
Here, I don't let it capture everything before the question mark because it simply isn't needed. This gives you a much easier to understand regular expression without the need of inserting captured parameters! ;)

Because remember to KISS! (Keep It Short and Simple)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
05-03-2007 06:28 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Replacing "?" - by Jimbo on 05-03-2007 at 04:43 PM
RE: Replacing "?" - by Ezra on 05-03-2007 at 05:01 PM
RE: Replacing "?" - by Jimbo on 05-03-2007 at 06:01 PM
RE: Replacing "?" - by Matti on 05-03-2007 at 06:28 PM
RE: Replacing "?" - by Ezra on 05-03-2007 at 07:02 PM
RE: Replacing "?" - by CookieRevised on 05-03-2007 at 10:50 PM
RE: RE: Replacing "?" - by deAd on 05-03-2007 at 10:57 PM
RE: Replacing "?" - by CookieRevised on 05-03-2007 at 11:01 PM
RE: Replacing "?" - by Matti on 05-04-2007 at 04:40 PM


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