[英]Regex - avoid match if pattern prefixed with // - comment outs
I have the following regex (JS.match) pattern /@import ['"](.*)['"]/g
allowing for the external files inclusion so eg 我有以下正则表达式(JS.match)模式/@import ['"](.*)['"]/g
允许包含外部文件,例如
@import "/my/path"
returns /my/path
@import "/my/path"
返回/my/path
all works as expected but I would like to enable commenting out with //
and /* */
一切都按预期工作,但我想启用//
和/* */
注释掉
so if string contains //@import "/my/path"
or /* @import "/my/path" */
then there should be NO match. 因此,如果字符串包含//@import "/my/path"
或/* @import "/my/path" */
则应该没有匹配项。
any ideas? 有任何想法吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.