简体   繁体   English

如何提取包含特定字母的单词字符串 r

[英]how to extract word string contains specific letter in r

Hi Team I have 100+ rows with https://.....嗨团队我有 100 多行 https://.....

like below像下面

https://clinicaltrials.gov/show/NCT05301842
https://am.asco.org/sites/am.asco.org/files/AM17-Proceedings.pdf; https://ascopubs.org/doi/10.1200/JCO.2017.35.15_suppl.11520; https://clinicaltrials.gov/ct2/show/NCT01564368; https://pubmed.ncbi.nlm.nih.gov/30179110/; https://pubs.rsna.org/doi/10.1148/radiol.2018180273?url_ver=Z39.88-2003&rfr_id=ori:rid:crossref.org&rfr_dat=cr_pub%20%200pubmed; https://rad.washington.edu/about-us/academic-sections/breast-imaging/research/; https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6283325/
https://clinicaltrials.gov/ct2/show/NCT05382741; https://www.clinicaltrialsregister.eu/ctr-search/search?query=2020-001588-10
https://clinicaltrials.gov/show/NCT05267392
https://clinicaltrials.gov/ct2/show/NCT02830282; https://www.cancer.gov/about-cancer/treatment/clinical-trials/search/v?id=NCI-2014-00596; https://www.ispytrials.org/i-spy-platform/substudies/i-spy2-surmount-study
https://clinicaltrials.gov/show/NCT05262985
https://clinicaltrials.gov/show/NCT05255653; https://ijgc.bmj.com/content/31/Suppl_3/A108.2
https://clinicaltrials.gov/show/NCT05253131
https://clinicaltrials.gov/show/NCT05245994
https://clinicaltrials.gov/show/NCT05239169; https://www.clinicaltrialsregister.eu/ctr-search/search?query=2021-002389-41

I need to extract words contains "NCT" and want the desire output like below我需要提取包含“NCT”的单词并想要如下所示的愿望 output

NCT05301842
NCT01564368
NCT05267392
NCT05262985
NCT05255653
NCT05253131
NCT05245994
NCT05239169

Kindly help me out folks请帮助我的人

Thanks in advance提前致谢

We can use regmatch with pattern NCT\\d+ , which extracts the substrings starting with NCT我们可以将regmatch与模式NCT\\d+一起使用,它提取以NCT开头的子字符串

regmatches(s,gregexpr("NCT\\d+",s))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM