正则表达式匹配未关闭的标签

时间:2017-12-12 22:30:10

标签: javascript regex

我正在尝试制作一个正则表达式,找不到[[。

E.g。

在字符串

    Package 'ExifLib.PCL 1.0.1' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Package 'Microsoft.Bcl 1.1.6' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Package 'Microsoft.Bcl.Async 1.0.165' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Package 'Mobilist.AdvancedTimer.Forms.Plugin 1.0.1' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Package 'PCLStorage 1.0.2' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
Package 'Rg.Plugins.Popup 1.0.4' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

我正在尝试仅使用正则表达式匹配You have to add [[Qty of [[sugar and then [[process]] it with [[OtherIngredient]] [[Qty,因为结束标记未关闭。

这是我到目前为止的正则表达式: [[sugar

但它甚至匹配((\[\[\w*))(?!\s)[[process]]

1 个答案:

答案 0 :(得分:0)

你的正则表达式很接近;尝试使用这个正则表达式:

\[\[\w+(?!])