Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-ID: <3460713.alAdkCt8v1@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Thu, 14 Mar 2013 21:11:47 +0100 User-Agent: KNode/4.8.5 Content-Transfer-Encoding: 8Bit X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. <1514068.yciYkkSlex@PointedEars.de> MIME-Version: 1.0 Lines: 65 NNTP-Posting-Date: 14 Mar 2013 21:11:49 CET NNTP-Posting-Host: b5d10fd5.newsspool2.arcor-online.net X-Trace: DXC=nNDoG`j;CQG=8m7nZkdN^@A9EHlD;3YcB4Fo<]lROoRA8kF Stefan Weiss wrote: >> On 2013-03-14 14:52, Evertjan. wrote: >>> or my personal favorite for "any character": >>> >>> [\s\S]* >> >> Shortest way to match "any character including \n": >> [^] > > My research showed that this is a syntax error in Microsoft JScript in > version 5.8.23141 (IE/MSHTML 8.0) and before (and probably in version > 9.0.16440 in Browser Compatibility Mode, the same as with trailing commas > in Object and Array initialisers), and in Opera ECMAScript in version 9.64 > and before. [\s\S] is the safe approach. However, it should be noted that JSX:regexp.js [1, 2] supports PCRE_DOTALL since revision 275 (2012-09-19 CE) with var rx = new jsx.regexp.RegExp(/./, "s"); or var rx = new jsx.regexp.RegExp(".", "s"); being equivalent to var rx = /[\S\s]/; The pattern-match modifiers “(?s)” and “(?-s)" are also supported with a first String argument. (But they apply to the rest of the expression, not only the current group, as of yet.) This is particularly useful if you have many any-character occurrences in the expression. The “.” will _not_ be expanded in a character class, so as to retain its original meaning: var rx = new jsx.regexp.RegExp(/.[.]./, "s"); is equivalent to var rx = /[\S\s][.][\S\s]/; jsx.regexp.RegExp() is a factory/constructor that returns a reference to an augmented RegExp instance. So from here everything in your script can stay the same (global, case-insensitive, multi-line, and other flags are supported by the function as well). You may carefully import it into the global namespace, like jsx._import(jsx.regexp, ["RegExp"], null, ["RegExp2"]); // [3] or a variable declaration if you want to keep it efficient but local. ________ [1] [2] [3] -- PointedEars Twitter: @PointedEars2 Please do not Cc: me. / Bitte keine Kopien per E-Mail.