preg_replace 对包含 greater/less 的字符串比符号
preg_replace against string containing greater/less than signs
我目前正在使用此正则表达式来匹配参考文本中的 doi 字符串:
(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)
这适用于大多数 doi,例如:
Dahlin, J., Nissink, W., et al. (Jan 2015). PAINS in the Assay:
Chemical Mechanisms of Assay Interference and Promiscuous Enzymatic
Inhibition Observed during a Sulfhydryl-Scavenging HTS. J. Med. Chem.,
2015, 58 (5), pp 2091–2113. doi:10.1021/jm5019093
returns: 10.1021/jm5019093
此字符串上的相同正则表达式 returns a partial doi:
Schmoe, J., Doe, J., & McFly, M. (Jan 2011). Should adults with
children eat more chocolate ice cream?. Fancy Pants Journal, 33,
211-7. doi:10.1234/0867-5309(2001)039<0215:NINPHD>2.1.CO;3
returns 10.1234/0867-5309(2001)039
我期待10.1234/0867-5309(2001)039<0215:NINPHD>2.1.CO;3
我需要做什么才能占到 greater/left 比符号?
只需将它们从字符中删除 class:
(10[.][0-9]{4,}[^\s"/]*/[^\s"]+)
我目前正在使用此正则表达式来匹配参考文本中的 doi 字符串:
(10[.][0-9]{4,}[^\s"/<>]*/[^\s"<>]+)
这适用于大多数 doi,例如:
Dahlin, J., Nissink, W., et al. (Jan 2015). PAINS in the Assay: Chemical Mechanisms of Assay Interference and Promiscuous Enzymatic Inhibition Observed during a Sulfhydryl-Scavenging HTS. J. Med. Chem., 2015, 58 (5), pp 2091–2113. doi:10.1021/jm5019093
returns: 10.1021/jm5019093
此字符串上的相同正则表达式 returns a partial doi:
Schmoe, J., Doe, J., & McFly, M. (Jan 2011). Should adults with children eat more chocolate ice cream?. Fancy Pants Journal, 33, 211-7. doi:10.1234/0867-5309(2001)039<0215:NINPHD>2.1.CO;3
returns 10.1234/0867-5309(2001)039
我期待10.1234/0867-5309(2001)039<0215:NINPHD>2.1.CO;3
我需要做什么才能占到 greater/left 比符号?
只需将它们从字符中删除 class:
(10[.][0-9]{4,}[^\s"/]*/[^\s"]+)