I have an array which is the result of a wifi scan. each element of the list contains the BSSID and Signal level the surrounding AP’s.
Example:
Array[5]
0: "BSSID: b0:c5:54:dd:e1:20 Signal: -30"
1 "BSSID: b0:c5:54:dd:e1:20 Signal: -40"
2 "BSSID: b0:c5:54:dd:e1:20 Signal: -50"
3 "BSSID: b0:c5:54:dd:e1:20 Signal: -60"
How can I extract the BSSID and signal level? I know that I have to use a regex but I have never worked before with regex. Is anyone outthere good with regex that can give me some help with it please?
Hi @Cacoomba, just a thought… since those strings all have fixed lengths and structure, couldn’t you simply take the substrings at the given positions? Something like
We match "BSSID: " and "Signal: " respectively, followed by any sequence of non-whitespace characters. The return values are arrays where the first element is the whole match, and the second element the part within the (capturing parentheses), which is what we want (if there were more capturing parentheses they would be third, fourth etc.).