Javascript 用于匹配冒号和以点结尾的句子之间的文本的正则表达式
Javascript Regular expression to match text between a colon sign and sentences ended by a dot
假设我有这样一段文字:
This is the title: \ titles always have a colon
This is a regular sentence.
A sentence always ends with a period.
A sentence can
span multiple lines.
A sentence can contain numbers like 123.
The phrase can also contain "text enclosed in double quotes"
or 'text enclosed in single quotes'.
Other symbols that may appear in sentences are
the comma ,
the semicolon ;
the dollar sign $
parentheses ( )
the plus sign +
the minus sign -
and the square brackets[ ].
This is an isolated phrase that the regular expression should not match.
如何在 javascript 中创建一个正则表达式来匹配 brackets[ ]
之后第一个冒号 * 和最后一个句号之间的文本? (假设不会有其他冒号,如果有的话,他们会用双引号引起来)
我试过使用 :.*
但它匹配所有行。
假设我有这样一段文字:
This is the title: \ titles always have a colon
This is a regular sentence.
A sentence always ends with a period.
A sentence can
span multiple lines.
A sentence can contain numbers like 123.
The phrase can also contain "text enclosed in double quotes" or 'text enclosed in single quotes'.
Other symbols that may appear in sentences are
the comma ,
the semicolon ;
the dollar sign $
parentheses ( )
the plus sign + the minus sign - and the square brackets[ ].This is an isolated phrase that the regular expression should not match.
如何在 javascript 中创建一个正则表达式来匹配 brackets[ ]
之后第一个冒号 * 和最后一个句号之间的文本? (假设不会有其他冒号,如果有的话,他们会用双引号引起来)
我试过使用 :.*
但它匹配所有行。