Regular expressions Examples of non-packet capture captured appreciated

A few examples

First, the use of captive ()

For example, 0.23

1、(^\d+)(\.)(\d{0,2})

 

Regular expressions 3 () is generated using the 3 match packets

2、^\d+\.\d{0,2}

 

 

 

 

 No (), no packet

Second, the non-captive (? :)

(?:^\d+)(\.)(\d{0,2})

 

The first group is no longer capture

 

Guess you like

Origin www.cnblogs.com/zhaogaojian/p/12207959.html