title: how do I extract characters consecutive to the substring and the substring itself After checking if string array contains the required substring
body: <p>Im trying to deal with the following string array called "wifis":-</p>
  
  <pre><code>[SSID: Stephen Joseph, BSSID: ##:a6:##:c0:21:##, capabilities: [WPA2-PSK-CCMP][WPS][ESS], level: -78, frequency: 2442, timestamp: 998653673499, hs2Info: &lt;none&gt;, distance: ?(cm), distanceSd: ?(cm), SSID: TP-LINK_G6D356, BSSID: 30:b5:c2:f5:$$:56, capabilities: [WPA-PSK-CCMP][WPA2-PSK-CCMP][WPS][ESS], level: -86, frequency: 2452, timestamp: !!!653673417, hs2Info: &lt;none&gt;, distance: ?(cm), distanceSd: ?(cm), SSID: cbtap998852211C:CF:7F:0A:AC:33, BSSID: 5e:cf:7f:0a:ac:91, capabilities: [ESS], level: -46, frequency: 2412, timestamp: 238653673402, hs2Info: &lt;none&gt;, distance: ?(cm), distanceSd: ?(cm), SSID: Tech_D0008214, BSSID: 70:5a:9e:65:30:56, capabilities: [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][ESS], level: -88, frequency: 2462, timestamp: 238653673422, hs2Info: &lt;none&gt;, distance: ?(cm), distanceSd: ?(cm), SSID: Tech_D0018138, BSSID: 50:09:59:83:ee:05, capabilities: [WPA-PSK-CCMP+TKIP][WPA2-PSK-CCMP+TKIP][ESS], level: -91, frequency: 2437, timestamp: 238653673427, hs2Info: &lt;none&gt;, distance: ?(cm), distanceSd: ?(cm)]
  </code></pre>
  
  <p>and I wish to check and extract <code>cbtap998852211C:CF:7F:0A:AC:33</code> and separate out <code>cbtap</code>as another string, <code>99885221</code> as another bcz its a dynamic 8 digit and the rest <code>1C:CF:7F:0A:AC:33</code> as another string.</p>
  
  <p>and its BSSID number <code>5e:cf:7f:0a:ac:91</code> from above String array.
  So as to check I have done <code>if(Arrays.asList(wifis).contains(confirmation)){</code> where confirmation is <code>cbtap</code> But how do I extract it and do the the above mentioned tasks.Please suggest the apprach.</p>