Reputation: 31
If I have a string and a pattern:
char src[]="\"http://www.aaa.cn\"</tab><tab>\"www.bbb.com\"";
char pattern[] = "\"http:\/\/.*\.com\"";
Then it returns "http://www.aaa.cn\"</tab><tab>\"www.bbb.com"
to me (it failed but continue matching next characters).
I just want some like "http://www.aaa.com"
, "http://www.bbb.com"
, not like that combined string.
Can someone help me out? Should I change my pattern or add some arguments to pcre_compile()
and pcre_exec()
functions?
Upvotes: 1
Views: 123
Reputation: 58589
Try this.
char pattern[] = "\"http://[^\"]*\"";
Better yet, don't parse HTML (or fragments thereof or XML) with regexen.
Upvotes: 2