All pastes #1500468 Raw Edit

Al's Weird Random tHing

public javascript v1 · immutable
#1500468 ·published 2009-07-19 21:38 UTC
rendered paste body
javascript:(function() {var input = prompt("Please enter a properly formatted string for the parser to look at:");if (!/^[\d?]+$/.test(input)) {/* This is a regular expression   In javascript, they're represented by   two forward slashes.   This regex :    ^ # Assert the beginning of the string.   [ # This is a character class (match anything in between here)     \d # Match any digit     ?  # Match question marks    ]   +  # Repeat the previous class as much as possible.   $ # Assert the end of the string.*/	alert("Erroneous syntax!");	return;}/* At this point, the input is verified and   no further error checking is needed.*/var out = "", currentChar;for(var i = 0; i < input.length; ++i) {	currentChar = input.charAt(i);	if(/\d+/.test(currentChar)) {		out += currentChar;	} else {		out += Math.round(Math.random() * 9);	}}alert(out);})();