person,
из документации с github
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script src="http://stacksnippets.net/scripts/snippet-javascript-console.min.js?v=1"></script>
<script>
function rgbaRegex(options) {
options = options || {};
return options.exact ?
/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)$/ :
/rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d*(?:\.\d+)?)\)/ig;
}
console.log("rgbaRegex({ exact: true }).test('rgba(12, 34, 56, .8)') => ", rgbaRegex({ exact: true }).test('rgba(12, 34, 56, .8)'));
console.log("rgbaRegex({ exact: true }).test('unicorns') => ", rgbaRegex({ exact: true }).test('unicorns'));
console.log("rgbaRegex({ exact: true }).test('rgba(,,,)') =>", rgbaRegex({ exact: true }).test('rgba(,,,)'));
console.log("rgbaRegex().exec('rgba(12, 34, 56, .8)') => ",rgbaRegex().exec('rgba(12, 34, 56, .8)'));
console.log("'rgba(12, 34, 56, .8) cats and dogs'.match(rgbaRegex()) => ",'rgba(12, 34, 56, .8) cats and dogs'.match(rgbaRegex()));
</script>
</head>
<body>
</body>
</html>