<html>
<head>
<title>Test</title>
<meta charset="UTF-8">
<script src="xregexp.js"></script>
<script src="unicode-base.js"></script>
<script src="unicode-scripts.js"></script>
<script>
var wordsToMatch = "Gr|Greek|ΕΛΛΗΝΙΚΑ";
var regexPattern = '\\b('+wordsToMatch+')';
var referenceRegex = new XRegExp(regexPattern, 'mi');
//var testString = "ΕΛΛΗΝΙΚΑ"; //null - ???
var testString = "Gr"; //Gr,Gr - OK AS IT SHOULD
var match = referenceRegex.exec(testString);
function myFunction()
{
alert(match);
}
</script>
</head>
<body onload="myFunction()">
</body>
</html>
I believe my example is quite explainable, it matches fine english words, I would like to match also Greek words too. I am not familiar with the unicode add-on of xregexp, my pattern was implemented to work with regexp.