正则表达式提取段包括制表符和新行分隔符

时间:2015-06-09 17:07:19

标签: regex perl

我有一个包含格式文本的字符串:

 $textOne\n;
 \t$textTwo\n;

示例:

$textOne = Lorem Ipsum
$textTwo = is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make 

Output is in the picture.

http://i.stack.imgur.com/NfoJA.png

这是一个字符串。我想将每个部分(标题和标签段)分解为它自己的元素,并将这些全部放在一个数组中。我无法确定用于查找此元素的正则表达式模式。如果我打破新行字符,那将分别给出标题和段落,这是不希望的。

谢谢!

1 个答案:

答案 0 :(得分:-2)

为了回答我自己的问题,我使用了:

'\n(?!\t)'