JSFiddle - React, Tailwind, and code Playground
by f0t0n
HTML
<textarea id="res"></textarea>
CSS
textarea {
width: 400px;
height: 300px;
resinze: none;
}
JavaScript
var console$ = $('#res');
function printLn(s) {
print(Array.prototype.join.call(arguments, ''), "\n");
}
function print(s) {
console$[0].value += Array.prototype.join.call(arguments, '');
console$.scrollTop(console$[0].scrollHeight - console$.height());
}
var re = /^https?:\/\/.+?\?.*?PostID=(\d+)/;
function getPostId(url) {
var matches = re.exec(url);
return matches ? matches[1] : null;
}
var correctInputStr = 'http://www.roblox.com/Forum/ShowPost.aspx?PostID=78212279',
incorrectInputStr = 'http://www.roblox.com/Forum/ShowPost.aspx?PostID=x78212279';
printLn(getPostId(correctInputStr));
printLn(getPostId(incorrectInputStr));