Javascript Check String Against Regex Pattern Java