how to use special characters in a switch - 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: how to use special characters in a switch (/showthread.php?tid=81506) how to use special characters in a switch by koen on 02-07-2008 at 09:35 AM
hi, RE: how to use special characters in a switch by Matti on 02-07-2008 at 10:52 AM
Well, you can make a regular expression which does this, but you can't use that in a switch...case block. code:Note that I made this regular expression so it'll match the word "question" only. That means, it won't match "questions". If you want it to match any occurrence of "question", it gets much simpler. Then, you can simply use this instead of the original first line: code: Note: In all these regular expressions, the "i" modifier was placed so they're case-insensitive. This is interesting if you capitalize the word for example. If you want it to be case-sensitive, just remove the "i" at the end. RE: how to use special characters in a switch by koen on 02-07-2008 at 11:01 AM oh thx! now it works RE: how to use special characters in a switch by markee on 02-07-2008 at 01:13 PM
quote: I think you mean the following expression.... code: \b just denotes the end of a word (beginning or end), if you were to have the lines of a commar or questionmark after the word "question" then yours wouldn't fire. Also the s modifier doesn't exist in JScript RE: how to use special characters in a switch by Spunky on 02-07-2008 at 10:00 PM
quote: I usedit fine and my script didn't work correctly without it RE: how to use special characters in a switch by markee on 02-08-2008 at 05:28 AM
I couldn't find any documentation online about it being part of JScript. However it is used for making the likes of "." match ANY character including \r and \n (both of these are not able to be matched by "." normally). RE: how to use special characters in a switch by Matti on 02-08-2008 at 08:22 AM Bah, okay then markee. I simply did some research on regular-expressions.info and I didn't scroll down enough. Thanks for correcting me. RE: how to use special characters in a switch by Spunky on 02-08-2008 at 05:42 PM
quote: http://www.javascriptkit.com/javatutors/redev2.shtml# http://authors.aspalliance.com/wsk/aboutregularexpression.asp Two pages from Google I found RE: how to use special characters in a switch by markee on 02-09-2008 at 02:13 AM
quote:I was talking specifically about the smodifier, your first link has g,iand m, and the second only talks about g and i. RE: how to use special characters in a switch by Spunky on 02-09-2008 at 11:10 AM Thats my fault then. I only saw the \s and thought it was that |