How to get a substring through regex in java android?

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.

Browse More Popular Posts

Leave a Comment