Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?<INUSE>[* ]):(?<BSSID>(?<BSSID0>[0-9A-F]{2}):(?<BSSID1>[0-9A-F]{2}):(?<BSSID2>[0-9A-F]{2}):(?<BSSID3>[0-9A-F]{2}):(?<BSSID4>[0-9A-F]{2}):(?<BSSID5>[0-9A-F]{2})):(?<SSID>.*?(?=:)):(?<MODE>.*?(?=:)):(?<CHAN>.*?(?=:)):(?<RATE>.*?(?=:)):(?<SIGNAL>\d{1,3}(?=:)):(?<BARS>.*?(?=:)):(?<SECURITY>.*?(?=:)):(?<FREQ>.*?(?=:)):(?<DEVICE>.*)
/
gm

Description

Extract different fields from the list output of nmcli: nmcli --terse --colors no --fields IN-USE,BSSID,SSID,MODE,CHAN,RATE,SIGNAL,BARS,SECURITY,FREQ,DEVICE device wifi list

Submitted by Simon Bagley - a year ago (Last modified a year ago)