标签: javascript regex
我正在尝试获取css属性的内容。我做到了:
cssText= "xxx blbla attr(MyContent); blabalableu"; RegexAttr= /attr\(([^()]+)/; matchAttr= RegexAttr.exec(cssText);
这给我一个匹配["attr(MyContent", "MyContent"]
["attr(MyContent", "MyContent"]
我只需要MyContent。是否有可能优化正则表达式以获取正确的值(仅括在方括号之间的字符串)。
MyContent