ソースコード var expression = '/html/body/div/[attribute::class="hoge fuga piyo"]'; var tokens = expression.match(/"[^"]*"|'[^']*'|\d+(?:\.\d*)?|\.\d+|\*|\/\/|\/|\||\+|!=|<=|>=|<|>|=|\(|\)|\[|\]|\.\.|\.|@|,|::|-|(?![0-9-:])[\w-]+:\*|\$(?:(?![0-9-:])[\w-]+:)?(?![0-9-:])[\w-]+|(?:(?![0-9-:])[\w-]+:)?(?![0-9-:])[\w-]+|\s+/g); // tokens is ["/", "html", "/", "body", "/", "div", "/", "[", "attribute", "::",