Question: I'm working with places, and I need to get the latitude and longitude of my location. I successfully got it like this

```
mLatLang  = placeLikelihood.getPlace().getLatLng();

```

where mLatLang is `LatLng mLatLang;` 

Now, the output of this line is

```
(-31.54254542,62.56524)

```

but since I'm using an URL to query results by the latitude and longitude, I can't put that data inside the query with the parenthesis `()`.

So far I have searched Stack Overflow for all kinds of Regex to remove this, but it seems I can't do it. I have tried this with no success:

```
types = placeLikelihood.getPlace().getPlaceTypes();
mLatLang  = placeLikelihood.getPlace().getLatLng();
String latlongshrink = mLatLang.toString();
latlongshrink.replaceAll("[\\\\[\\\\](){}]","");

```

I have also tried a lot more `replaceAll` Regex, but I can't remove them.

My output should be like this:

```
-31.54254542,62.56524

```

Answer: 
What you are missing in your logic is that `replaceAll` returns the resultant string. But you are not storing the result, and that's why it's not working. So try as following:

```
latlongshrink = latlongshrink.replaceAll("[\\\\[\\\\](){}]","");

```

Now try to print the result. It'll give the expected result. See [this](https://www.javatpoint.com/java-string-replaceall) for more information about `replaceAll()` function.
I just solved it with a Matcher

```
 Matcher m = Pattern.compile("\\(([^)]+)\\)").matcher(latlongshrink);
                        while(m.find()) {
                            Log.e("Test",""+m.group(1));
                            latlongshrink = m.group(1);
                        }

```