quote:
Originally posted by billboy1001
actually now that i did take the time to read, and with a few modifications my script is working perfectly now.
EDIT: how can i make a regular expression to split "hello world, hi" into "hello" and "world, hi" willcode:
RegExp(/^\s+(\S+)\s+(.+)$/i).exec(sMessage)
do it?
teaching regular expressions via a post here is way to difficult. I suggest you read up on some tutorials. And start by learning the syntax of regular expressions as used in JScript:
*
MSDN: Regular Expression Syntax
*
MSDN: Regular Expression Object
*
some unofficial tutorial (this tutorial is specifically for JavaScript, not JScipt. There are differences!
* etc...
The proper code for what you want could be something like:
code:
RegExp(/^(\S+)\s+(.+)$/i).exec(sMessage)
RegExp.$1 will be "hello"
RegExp.$2 will be "world, hi"
Note that for the above regular expression the sMessage variable _must_ be in the form of "
something<at least 1 spacing character>something" or it will not work.
See my long previous post, it includes two pieces of code which split a string into "something" and "all the rest".