Hi,
Try:
a1<- "...verified email at neu.edu<br>Cited by 
99853<br></td></tr></table></div></div></div></div><div..."
gsub(".*Cited by\\s+([0-9]+).*","\\1",a1)
#[1] "99853"
A.K.



----- Original Message -----
From: Thomas <thomas.ches...@nottingham.ac.uk>
To: r-help@r-project.org
Cc: 
Sent: Wednesday, August 14, 2013 8:14 AM
Subject: [R] Grabbing numbers inside a character string

I have a string that contains something like:

...verified email at neu.edu<br>Cited by 99853<br></td></tr></table></ 
div></div></div></div><div...

and I'd like to extract the number next to the text "Cited by " - so  
it will be whatever numbers are beside "Cited by " until a non-numeric  
character is reached.

Can anyone suggest a good way of doing this please?

Thank you,

Thomas
This message and any attachment are intended solely for the addressee and may 
contain confidential information. If you have received this message in error, 
please send it back to me, and immediately delete it.   Please do not use, copy 
or disclose the information contained in this message or in any attachment.  
Any views or opinions expressed by the author of this email do not necessarily 
reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system, you 
are advised to perform your own checks. Email communications with the 
University of Nottingham may be monitored as permitted by UK legislation.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to