What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Request] A simple regular expression function

[Request] A simple regular expression function
Author: Message:
markee
Veteran Member
*****

Avatar

Posts: 1621
Reputation: 50
35 / Male / Flag
Joined: Jan 2006
RE: [Request] A simple regular expression function
quote:
Originally posted by Mattike
Could you try to find some time to get it working in some way? :)
Got it working now

code:
function moveToEnd(oString,sub){
    var re = RegExp(".*?"+sub+"+(?!$)","gim");
    eString = oString;
    while(re.exec(oString) != null){
        eString = eString.replace(RegExp("(.*?)("+sub+"+)(.*)","gi"),"$1$3$2");
    }
    return eString;
}
This has FAR less itterations and should respond quicker.  Realy I should do error checking to make sure sub is only a single character, but if you are carful then there shouln't be any problem and will work faster.

I hope this helps :)

This post was edited on 04-30-2008 at 10:00 AM by markee.
[Image: markee.png]
04-30-2008 09:39 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Request] A simple regular expression function - by Skarbo on 04-28-2008 at 09:33 AM
RE: [Request] A simple regular expression function - by markee on 04-28-2008 at 11:14 AM
RE: [Request] A simple regular expression function - by John Anderton on 04-28-2008 at 05:40 PM
RE: [Request] A simple regular expression function - by markee on 04-28-2008 at 08:48 PM
RE: [Request] A simple regular expression function - by Matti on 04-29-2008 at 04:43 PM
RE: [Request] A simple regular expression function - by Skarbo on 04-29-2008 at 04:52 PM
RE: [Request] A simple regular expression function - by markee on 04-30-2008 at 09:39 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