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

RegExp - exec
Author: Message:
phalanxii
Full Member
***


Posts: 146
Reputation: 5
32 / Male / Flag
Joined: Aug 2006
Status: Away
RE: RegExp - exec
If you want a quick fix, try:
code:
var MyString = "C:\\David\\eg.png";
var re = /([^\/\\]*)\./;
var FileBase = re.exec(MyString)[1];
But just as an explanation, when you use the new RegExp("...") notation, your regular expression is taken from what it appears as a string. That means new RegExp("\\\\a\\\\") works the same as /\\a\\/, both of which capture a string which displays as \a\. My regular expression captures a group of letters that are not slashes up to a full-stop. Be aware that if there are no matches though, your script will have an error.
08-22-2007 11:14 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
RegExp - exec - by davidpolitis on 08-22-2007 at 10:35 AM
RE: RegExp - exec - by phalanxii on 08-22-2007 at 11:14 AM
RE: RegExp - exec - by davidpolitis on 08-22-2007 at 11:21 AM
RE: RegExp - exec - by markee on 08-22-2007 at 11:29 AM
RE: RE: RegExp - exec - by davidpolitis on 08-22-2007 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