### 零宽断言之正预测先行断言(?=exp)用法 > 聊聊正则的正预测先行断言, 断言自身出现的位置的后面能匹配表达式exp ###### 示例 找出如下字符串中的规定数字后面必须有px ```js const str = '1pt 2px 3em 4px' ``` 正则 ```js /\d(?=px)/g ``` <img src="https://user-images.githubusercontent.com/20992106/51540291-0422ee00-1e91-11e9-9096-b8158f48982a.png" width="400"> [在线调试](https://regex101.com/r/0bXGw7/1)