I have a text file that in it i have some text's that i must collect them. My text is like this. I want to extract networks count,networks name and networks password. I tried to use regular expression but I do not know what expression i must use for this.Thanks for your helping.
Asked
Active
Viewed 83 times
-5
-
2could you share your try? – XOR-Manik Sep 18 '15 at 18:34
-
Post some code showing your attempt at the regular expression. – Evan LaHurd Sep 18 '15 at 18:35
-
I tried to use [this link](http://stackoverflow.com/questions/6560672/java-regex-to-extract-text-between-tags) but. i do not know how to use it exactly. – Jesus fernandez Sep 18 '15 at 18:37
-
don't post more links... show your code implementation so far... so we can help you. – Mariano Zorrilla Sep 18 '15 at 18:38
-
just public static void extractinfo(String config_file) { ArrayList
networkandinfo=new ArrayList<>(); } – Jesus fernandez Sep 18 '15 at 18:40 -
why you do not want to answer?:( – Jesus fernandez Sep 18 '15 at 18:50
-
what is the network name, network count and network password in your link? I could not find the variables with these names. – XOR-Manik Sep 18 '15 at 19:12
-
this text file is wpa_supplicant.conf file in data/misc/wifi folder of phone or tablet. in this file networks info that device connect to them restored. sorry i mean SSID, PSK. – Jesus fernandez Sep 18 '15 at 19:19
1 Answers
0
Okay, So to extract the ssid and psk from the file, you can try this :
ssid="([\w ]+)"|psk="([\w ]+)"
where it searches for
-->ssid=" and extracts the content within the ". Similarly for the psk.
There is a OR between them so it will search for both the words. You can get the extracted data with the help of numbered groups.
PS: Do not forget to escape the characters.

XOR-Manik
- 493
- 1
- 4
- 19
-
well you can always upvote or accept the answer instead of thanks ;) – XOR-Manik Sep 18 '15 at 20:08