加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

思科正则表达式与此匹配但不是这样

发布时间:2020-12-14 05:50:42 所属栏目:百科 来源:网络整理
导读:我在一个更大的配置中有以下字符串: as-path-set DAVE-9999-CBGas-path-set DAVE-9999-CBGas-path-set DAVE-55555-CBGas-path-set DAVE-44444-CBGas-path-set DAVE-33333-CBGas-path-set DAVE-22222-CBGas-path-set DAVE-22222-CBG 我想匹配所有这些行,除了
我在一个更大的配置中有以下字符串:

as-path-set DAVE-9999-CBG
as-path-set DAVE-9999-CBG
as-path-set DAVE-55555-CBG
as-path-set DAVE-44444-CBG
as-path-set DAVE-33333-CBG
as-path-set DAVE-22222-CBG
as-path-set DAVE-22222-CBG

我想匹配所有这些行,除了包含9999的行.我不理解否定正则表达式,以使这项工作.有人可以帮忙吗理想的输出将是:

as-path-set DAVE-55555-CBG
as-path-set DAVE-44444-CBG
as-path-set DAVE-33333-CBG
as-path-set DAVE-22222-CBG
as-path-set DAVE-22222-CBG

解决方法

你可以使用负向前瞻:

^as-path-set DAVE-(?!9999)[0-9]+-CBG$

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读