【发布时间】:2019-06-16 13:38:27
【问题描述】:
我有以下字符串:
x <- "\n\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\n\t\t\tGEO Publications\n\t\t\t\t\tHandout\n\t\t\t\t\t\tNAR 2013 (latest)\n\t\t\t\t\t\tNAR 2002 (original)\n\t\t\t\t\t\tAll publications\n\t\t\t\t\t\n\t\t\t\tFAQ\n\t\t\t\tMIAME\n\t\t\t\tEmail GEO\n\t\t\t\n \n \n \n \n \n \n NCBI > GEO > Accession Display\nNot logged in | Login\n\n \n \n \n \n \n \n \n \n\n \n \n\nGEO help: Mouse over screen elements for information.\n\nScope: SelfPlatformSamplesSeriesFamily\n Format: HTMLSOFTMINiML\n Amount: BriefQuick\n GEO accession: \n\n\n\n Sample GSM935277\n\nQuery DataSets for GSM935277\nStatus\nPublic on May 22, 2012\nTitle\nStanford_ChipSeq_GM12878_TBP_IgG-mus\nSample type\nSRA\n \n\nSource name\nGM12878\nOrganism\nHomo sapiens\nCharacteristics\nlab: Stanfordlab description: Snyder - Stanford Universitydatatype: ChipSeqdatatype description: Chromatin IP Sequencingcell: GM12878cell organism: humancell description: B-lymphocyte, lymphoblastoid, International HapMap Project - CEPH/Utah - European Caucasion, Epstein-Barr Viruscell karyotype: normalcell lineage: mesodermcell sex: Ftreatment: Nonetreatment description: No special treatment or protocol appliesantibody: TBPantibody antibodydescription: Mouse monoclonal. Immunogen is synthetic peptide conjugated to KLH derived from within residues 1 - 100 of HumanTATA binding protein TBP. Antibody Target: TBPantibody targetdescription: General transcription factor that functions at the core of the DNA-binding multiprotein factor TFIID. Binding of TFIID to the TATA box is the initial transcriptional step of the pre-initiation complex (PIC), playing a role in the activation of eukaryotic genes transcribed by RNA polymerase II."
我想要做的是检测这种形式的模式:
Antibody Target: TBPantibody
并返回子串结果TBPantibody。
我试过这个正则表达式,但它不起作用
sub("Antibody Target: ([A-Zaz]+)\\W+", "\\1", x)
正确的做法是什么?
【问题讨论】:
-
您知道,在给出答案后默默地删除一个问题(另一个问题)可能会导致那些花时间帮助您的人产生不好的感觉,不是吗?