-
Java regex Lookaround
- see: http://www.rexegg.com/regex-lookarounds.html
- Four ways of using lookarounds:
- (?= lookahead
(?=d{3} dollars).{3}
(Lookahead). Looks ahead for three digits followed by " dollars". Matches "100" in "100 dollars"
- (?! negative lookahead
(?!=d{3} pesos)d{3}
(Negative Lookahead). Makes sure what follows is not three digits followed by " pesos". Matches "100" in "100 dollars"
- (?<= lookbehind
(?<=USD)d{3}
(Lookbehind). Makes sure "USD" precedes the text to be matched. Matches "100" in "USD100"
- (?<! negative lookbehind
(?<!USD)d{3}
(Negative Lookbehind). Makes sure "USD" does not precede the text to be matched. Matches "100" in "JPY100"
- Lookaround after match:
d{3}(?= dollars)
(Lookahead). Makes sure " dollars" follows the three digits to be matched. Matches "100" in "100 dollars"
d{3}(?! dollars)
(Negative Lookahead) Makes sure " dollars" does not follow the three digits to be matched. Matches "100" in "100 pesos"
.{3}(?<=USDd{3})
(Lookbehind). Looks behind for "USD" followed by three digits. Matches "100" in "USD100"
-
d{3}(?<!USDd{3})
(Negative Lookbehind). Makes sure what precedes is not "USD" followed by three digits. Matches "100" in "JPY100"
- n
- n
- n
- n
-
相关阅读:
音视频入门-15-手动生成一张JPEG图片
音视频入门-14-JPEG文件格式详解
音视频入门-13-使用开源库生成PNG图片
微信小程序笔记
JS找到嵌套在iframe内联框架中的table表头元素
京东 PC 首页 2019 改版前端操作总结
web前端开发中各种图片引入方式及其优缺点
10个面向前端开发人员的安全提示
HTML/CSS switch开关 (包括JS控制checked选择)
Echarts常用属性含义
-
原文地址:https://www.cnblogs.com/wade-case/p/3381739.html
Copyright © 2020-2023
润新知