0

输入

-n. 1 geographical map or plan, esp. for navigation. 2 sheet of information in the form of a table, graph, or diagram. 3 (usu. in pl.) colloq. listing of the currently best-selling pop records. -v. make a chart of, map. [Latin charta: related to *card1]

我需要这样拆分
-n.
1 geographical map or plan, esp. for navigation.
2 sheet of information in the form of a table, graph, or diagram.
3 (usu. in pl.) colloq. listing of the currently best-selling pop records.
-v.
make a chart of, map. [Latin charta: related to *card1]

我的表情在这里 ((—\w\.)|(\d\s))(([^\d—])*)

但这失败了card1]

如何解决这个问题?

如何否定digit followed with space

4

2 回答 2

3

利用前瞻:

((-\w\.)|(\d\s))(([^\d-]|(\d(?!\s))|(-(?!\w\.)))*)

您需要任意数量的非数字或非破折号 ( [^\d-]),但您还希望允许数字后面不跟空格(\d(?!\s))和连字符,后面不跟字符和句点(-(?!\w\.))

于 2012-04-15T09:28:19.500 回答
-1

您应该对输入字符串执行Regex.Escape 。

于 2012-04-15T08:04:41.623 回答