0

I have a url that would contain something like this:

%5B%7B%22field%22%3A%22Site+Code%22%2C%22value%22%3A%2245%22%7D%2C%7B%22field%22%3A%22textarea-1%22%2C%22value%22%3A%2212%22%7D%2C%7B%22field%22%3A%22Serial+%23%22%2C%22value%22%3A%2223%22%7D%5D%26SiteID%3D1%3B

I'm taking in the url as a string and would like to convert all the regex to special characters. Is there any way to do this? The regex is not limited to just this. I need to take into account all instances in which regex could show up in the string, and replace it with the corresponding special character.

Paolo
  • 21,270
  • 6
  • 38
  • 69
Gerald Tan
  • 91
  • 14

1 Answers1

2

Since there are so many special characters you will need to account for, and in regex you will have to replace each one seperately, I do not think that regex is the best solution to this issue. A better solution is available here: How to do URL decoding in Java?

Jacob Boertjes
  • 963
  • 5
  • 20