So, I have this question here, which has been answered. I'm looking to replicate the marked answer in Java. Is there any way I can do some/most/all of it in Java?
-
3I don't know. Have you tried it yet?crush– crush2014-01-08 22:29:41 +00:00Commented Jan 8, 2014 at 22:29
-
1Tried doing it in Java, you mean? I've been looking around for a solution, but nothing I saw does what the grep command does.CodingInCircles– CodingInCircles2014-01-08 22:31:41 +00:00Commented Jan 8, 2014 at 22:31
-
1Something like this? stackoverflow.com/questions/7062954/…. That would be ideal, except that I need to capture 4 different strings as opposed to only one that the poster of that question is trying to get.CodingInCircles– CodingInCircles2014-01-08 22:34:43 +00:00Commented Jan 8, 2014 at 22:34
-
2You could go with stackoverflow.com/a/13592567/1266906TheConstructor– TheConstructor2014-01-08 22:42:56 +00:00Commented Jan 8, 2014 at 22:42
-
1I'll give it a shot. Do you happen to know if it works with partial URLs? As you can see, the URL does not really have a "http://..." in front of it.CodingInCircles– CodingInCircles2014-01-08 22:46:43 +00:00Commented Jan 8, 2014 at 22:46
|
Show 1 more comment
1 Answer
Of course Java can be used to replace grep as seen e.g. in this question.
As you really want extract parameter values from a URL you could e.g. go with this approach, where a simple Java-function returns all parameters and their values as a Map. If you already use a HTTP-related library you may also want to look if they included a similar function.