我想从具有其他特定属性的html标记获取属性值。
int main(int argc, char **argv) {
omrthread_t attachedThread = NULL;
J9PortLibraryVersion portver;
J9PortLibrary portlib;
intptr_t rc;
intptr_t fd;
rc = omrthread_init_library();
if (rc != 0) {
printf("omrthread_init_library failed with: %lld\n", rc);
return 1;
}
rc = omrthread_attach_ex(&attachedThread, J9THREAD_ATTR_DEFAULT);
if (rc != 0) {
printf("omrthread_attach_ex failed with: %lld\n", rc);
return 1;
}
J9PORT_SET_VERSION(&portver, J9PORT_CAPABILITY_MASK);
rc = j9port_init_library(&portlib, &portver, sizeof(portlib));
if (rc != 0) {
printf("j9port_init_library failed with: %lld\n", rc);
return 1;
}
答案 0 :(得分:0)
你想要这样的东西:
var attrRegExp = /<(?=[^>]+attr1)[^>]+attr2=["']([^"']+)/ig;
var match = attrRegExp.exec(text);
while (match != null) {
// capturing group 1: match[1]
match = attrRegExp.exec(text);
}
这将遍历所有HTML,并且相关属性将匹配[1]。例如,您可以将所有匹配推送到数组。