str = "find().nodes() as n3"= =比;找到
str = ";= = =比;
使用字符串match
与正则表达式模式^w+
:
var inputs = ["find().nodes() as n3", "with n1,n2,n3"];
inputs.forEach(x => console.log(x + " => " + x.match(/^w+/)));