Dear R-users,

How do I extract numbers between asp?P= and &VID from my txt vector? I have
tried grep function with no luck.

txt <- c("
http://www.mysite.com/system/empty.asp?P=2&VID=default&SID=421384237289476&S=1&C=18631",
"
http://www.mysite.com/system/empty.asp?P=123&VID=default&SID=421384237289476&S=1&C=18643",
"
http://www.mysite.com/system/empty.asp?P=342&VID=default&SID=421384237289476&S=1&C=18634
","
http://www.mysite.com/system/empty.asp?P=232&VID=default&SID=421384237289476&S=1&C=18645",
"
http://www.mysite.com/system/empty.asp?P=2345&VID=default&SID=421384237289476&S=1&C=18254",
"
http://www.mysite.com/system/empty.asp?P=257654&VID=default&SID=421384237289476&S=1&C=18732",
"
http://www.mysite.com/system/empty.asp?P=22&VID=default&SID=421384237289476&S=1&C=18637",
"
http://www.mysite.com/system/empty.asp?P=2463&VID=default&SID=421384237289476&S=1&C=18575
")

The result should be like
2
123
342
232
2345
257654
22
2463

Thanks,
Lauri

	[[alternative HTML version deleted]]

