Prev: FAQ Topic - Why doesn't the global variable "divId" always refer to the element with id="divId"? (2010-06-10)
Next: Dynamically Creating Checkboxes
From: Thomas 'PointedEars' Lahn on 13 Jun 2010 07:09 Dr J R Stockton wrote: > stevewy(a)hotmail.com posted: >> I'm just trying to work out (if what I want is at all possible), a >> regular expression that will search for and select (in a text editor >> that supports regexps, like Notepad++) the word "onclick", then any >> text at all, up to and including ">". > > How "like" must it be? > > MiniTrue will do it, at least at the XP 32-bit command line (CMD.EXE) : > > PROMPT>mtr $1.htm "onclick[^^]*>" > > The character ^ is a command-line escape, so only the second one counts; > [^] thus means to search for not nothing, which, at least in MiniTrue, > is a more potent "anything" than a mere dot is. BTW, my tests¹ have showed that this negated empty character range is not supported by JScript up to including version 5.7.5730 (in IE 7.0; tests with IE 8 pending). But it is supported since JavaScript 1.5 (Mozilla/5.0), Google V8 2.1 (maybe earlier), Apple JavaScriptCore 530.17 (Safari 4), Opera 5.02, and KJS 4.4.3 (maybe earlier). As an alternative, /[\x00-\xFF\u0100-\uFFFD]/ can be used, whereas `\u0100-\uFFFD' should only be used if Unicode support had been detected. A way to do this is var allChars = "[\x00-\xFF[UNICODE]]" .replace("[UNICODE]", "\uFFFD".length == 1 ? "\u0100-\uFFFD" : ""); var rx = new RegExp(allChars); PointedEars ___________ ¹ <http://PointedEars.de/es-matrix#features> -- Use any version of Microsoft Frontpage to create your site. (This won't prevent people from viewing your source, but no one will want to steal it.) -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.) |