Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 要使用哪个正则表达式在R中提取stri_正则表达式中的专有信息?_Regex_R_Stringi - Fatal编程技术网

Regex 要使用哪个正则表达式在R中提取stri_正则表达式中的专有信息?

Regex 要使用哪个正则表达式在R中提取stri_正则表达式中的专有信息?,regex,r,stringi,Regex,R,Stringi,我试图在R中的这个字符中提取出一个紧跟在这个单词后面的名字gdac.broadinstitute.org element <- "<li><a href=\"gdac.broadinstitute.org_BRCA.miRseq_Preprocess.mage-tab.2015020400.0.0.tar.gz.md5\"> gdac.broadinstitute.org_BRCA.miRseq_Preprocess.mage-tab.2015020400.0.0.

我试图在R中的这个字符中提取出一个紧跟在这个单词后面的名字
gdac.broadinstitute.org

element <- "<li><a href=\"gdac.broadinstitute.org_BRCA.miRseq_Preprocess.mage-tab.2015020400.0.0.tar.gz.md5\"> gdac.broadinstitute.org_BRCA.miRseq_Preprocess.mage-tab.2015020400.0.0.tar.gz.md5</a></li>"

有人可以帮忙吗?

我不熟悉
stringi
,但可以使用
gsub
轻松完成。我可以得到名称的结尾,所以我假设名称是

试试这个:

stri_extract_first_regex( element, "(?<=gdac.broadinstitute.org_)[\\w\\.-]+")

stri_extract_first_regex(element),(?谢谢!很好:)你能准确地指出你想从字符串中提取什么吗?”>gdac.broadinstitute.org_BRCA.miRseq_Preprocess.mage tab.201502040.0.0.tar.gz.md5——你想要“BRCA”还是“gdac.broadinstitute.org”后面的所有内容?
gsub(".*gdac.broadinstitute.org_(.*)\".*", "\\1", element)
stri_extract_first_regex( element, "(?<=gdac.broadinstitute.org_)[\\w\\.-]+")