Shoutbox

[?] variables into regular expressions - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [?] variables into regular expressions (/showthread.php?tid=71596)

[?] variables into regular expressions by roflmao456 on 02-11-2007 at 12:19 AM

i wonder how i could put variables into regular expressions?

help or whatever will be helpful.


RE: [?] variables into regular expressions by deAd on 02-11-2007 at 12:54 AM

You can create a regular expression from a string:

code:
// Create a string to store the pattern of our regular expression
var sRegExp = "[abc]+";
// Create a RegExp object with the pattern as sRegExp and the flags as "i" (case insensitivity)
var rRegExp = new RegExp(sRegExp, "i");

You can insert variables in the string.
RE: [?] variables into regular expressions by roflmao456 on 02-11-2007 at 02:20 AM

thanks LOL it actually works ! woot


RE: RE: [?] variables into regular expressions by deAd on 02-11-2007 at 02:35 AM

quote:
Originally posted by roflmao456
thanks LOL it actually works ! woot

why's that funny? :undecided:
RE: [?] variables into regular expressions by roflmao456 on 02-11-2007 at 02:40 AM

quote:
Originally posted by deAd
why's that funny? :undecided:

[offtopic] i do not know. [/offtopic]

but anyways thanks for the help :)