用正则表达式提取子弹的编号

时间:2015-12-11 17:05:58

标签: regex

我正在尝试选择位于行首和以点结尾的数字。示例如下:

1. Samish I, Macdermaid CM, Perez-Aguilar JM, Saven
JG (2011) Theoretical and computational protein
design. Annu Rev Phys Chem 62:129–149.


2. Kiss G, C¸elebi- €Olc¸€um N, Moretti R, Baker D, Houk KN
(2013) Computational enzyme design. Angew Chem Int
Ed Engl 52:5700–5725.


3. Ghadessy FJ, Ong JL, Holliger P (2001) Directed evo-
lution of polymerase function by compartmentalized
self-replication. Proc Natl Acad Sci USA 98:4552–4557.
4. Cauchy M, D’Aoust S, Dawson B, Rode H, Hefford MA
(2002) Thermal stability: a means to assure tertiary
structure in therapeutic proteins. Biologicals 30:175–
185.

结果如下:1. 2. 3. 4.

我正在使用以下正则表达式[^/]\d\.但是,所有以点结尾的数字也会被选中。谁能告诉我我做错了什么?

1 个答案:

答案 0 :(得分:2)

您需要在MULTILINE模式下使用此正则表达式:

^\d+\.

另一方面,您的正则表达式[^/]\d\.表示非斜杠后跟一个数字,后跟DOT。