我正在尝试编写一个JavaScript正则表达式,它将捕获一行的末尾,除非该行以右括号结束,例如:
[word]
lengthy text line
[other word]
even lengthier text line! Whoo!
这部分我不愿意写此正则表达式new RegExp(/[\n]\n|(?![^\]])$/gm)
但是即使在没有双倍空格的情况下,我也必须能够抓住行尾,并且事实证明超级困难,因为我对Regex并不了解。
-- [word]
These two lines need to be grouped -- lengthy text line
-- [other word]
These two lines need to be grouped -- even lengthier text line! Whoo!
This needs to be it's own group -- This text line is the longest of them all!
-- [more words]
These two lines need to be grouped -- The last guy can win...
令人讨厌的是,有一个非常简单的Regex可以实现此目标,但是FireFox当前不支持它,这是一个问题。 (?<!])\n
断言背后的负面表情