js-identifiers/regex.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Regex for Validation of JavaScript identifiers</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript">
var regex = [];
var tree = [];
$(function()
{
regex = $('span', '#regex');
tree = $('li', '#tree');
$().add(tree)
.attr('title', 'Click to go to related documentation.')
.add(regex)
.animate({backgroundColor:'transparent'})
.mouseenter(enterHandler)
.mouseleave(leaveHandler);
$(window.frameElement).height($(document).height());
$(window.frameElement).height($('html').height());
});
function getPos(item)
{
var pos = $.inArray(item, regex);
return pos > -1 ? pos : $.inArray(item, tree);
}
function enterHandler(event)
{
var pos = getPos(this);
$()
.add(regex[pos])
.add(tree[pos])
.stop(true)
.animate({backgroundColor:'#fd8'}, 'fast');
}
function leaveHandler(event)
{
var pos = getPos(this);
$()
.add(regex[pos])
.add(tree[pos])
.stop(true, true)
.animate({backgroundColor:'transparent'}, 'slow');
}
</script>
<style>
body
{
font-family: sans-serif;
}
#regex
{
text-align: center;
}
#tree
{
font-size: 80%;
}
#tree li
{
list-style-position: inside;
padding: .1em .4em;
}
#tree li a:link
{
text-decoration: none;
color: #000;
}
#tree li a:hover
{
text-decoration: underline;
}
#footer
{
text-align: center;
font-size: 60%;
color: #555;
}
</style>
</head>
<body>
<pre id="regex"><span>^</span><span>[<span>$_</span><span>\p{L}</span>]</span><span>[<span>$_</span><span>\p{L}</span><span>\p{Mn}</span><span>\p{Mc}</span><span>\p{Nd}</span><span>\p{Pc}</span><span>\u200C</span><span>\u200D</span>]</span><span>*+</span><span>$</span></pre>
<div id="tree">
<ul>
<li class="regexanchor"><a href="http://www.regular-expressions.info/anchors.html">Assert position at the beginning of the string</a>
<li class="regexcharclass"><a href="http://www.regular-expressions.info/charclass.html">Match a single character present in the list below</a>
<ul class="regexbuddy">
<li class="regexcharclasschar"><a href="http://www.regular-expressions.info/charclass.html">One of the characters "$_"</a>
<li class="regexcharclassspecial"><a href="http://www.regular-expressions.info/unicode.html#prop">A character with the Unicode property "letter" (any kind of letter from any language)</a>
</ul>
<li class="regexcharclass"><a href="http://www.regular-expressions.info/charclass.html">Match a single character present in the list below</a>
<ul class="regexbuddy">
<li class="regexcharclasschar"><a href="http://www.regular-expressions.info/charclass.html">One of the characters "$_"</a>
<li class="regexcharclassspecial"><a href="http://www.regular-expressions.info/unicode.html#prop">A character with the Unicode property "letter" (any kind of letter from any language)</a>
<li class="regexcharclassspecial"><a href="http://www.regular-expressions.info/unicode.html#prop">A character with the Unicode property "non-spacing mark" (a character intended to be combined with another character that does not take up extra space (e.g. accents, umlauts, etc.))</a>
<li class="regexcharclassspecial"><a href="http://www.regular-expressions.info/unicode.html#prop">A character with the Unicode property "spacing combining mark" (a character intended to be combined with another character that takes up extra space (vowel signs in many Eastern languages))</a>
<li class="regexcharclassspecial"><a href="http://www.regular-expressions.info/unicode.html#prop">A character with the Unicode property "decimal digit" (a digit zero through nine in any script except ideographic scripts)</a>
<li class="regexcharclassspecial"><a href="http://www.regular-expressions.info/unicode.html#prop">A character with the Unicode property "connector punctuation" (a punctuation character such as an underscore that connects words)</a>
<li class="regexcharclassspecial"><a href="http://www.regular-expressions.info/charclass.html">Unicode character U+200C</a>
<li class="regexcharclassspecial"><a href="http://www.regular-expressions.info/charclass.html">Unicode character U+200D</a>
<li class="regexrepeat"><a href="http://www.regular-expressions.info/possessive.html">Between zero and unlimited times, as many times as possible, without giving back (possessive)</a>
</ul>
<li class="regexanchor"><a href="http://www.regular-expressions.info/anchors.html">Assert position at the end of the string (or before the line break at the end of the string, if any)</a>
</ul>
</div>
<div id="footer">Exported from <a href="http://www.regexbuddy.com/">RegexBuddy</a> and tweaked by myself.</div>
</body>
</html>