Jump to content

User:Patient Zero/sandbox

From Wikipedia, the free encyclopedia

Testing things

[edit]

Formatting JavaScript code

[edit]

In the editor, precede your JavaScript code with this:

<syntaxhighlight lang="javascript">

and follow it with this:

</syntaxhighlight>

and it will turn out looking something like this:

// Here is the regular expression for matching the scoop target (to "scoop up" the redlinked entry with direct (non-piped) link, plus the whole next line)
var nodeScoop2 = new RegExp('\\n((\\*)+)[ ]*?\\[\\[\\s*'+(RegExp.quote(redlinks[i]))+'\\s*\\]\\].*?\\n(.*?\\n)','i');
 
// To actualize the search string above, we create a variable with method:
var matchString2 = wpTextbox1.value.match(nodeScoop2);
alert(matchString2); // for testing

// Declare match patterns
var patt1 = new RegExp(":");
var patt2 = new RegExp(" – ");
var patt3 = /$1\*/;