I'm absolutely not familiar with regexes so better to ask then do something very silly. I have a java application that is to be executed from command line, and it has a pretty nice signature.
java applicationName -mode=create -some.nice.arg=XXX.XXX.XXX.XXX:XXXX -another.nice.arg=value2 -third.nice.arg=value3 -again.nice.arg=value4 ... -nth.nice.arg=value_n+1
This would be the desired format. Well at least close enough. I'm trying to create a regexp that matches this and would select the argument fields like:
- mode=create
- some.nice.arg=XXX.XXX.XXX.XXX:XXXX
- another.nice.arg=value2
- third.nice.arg=value3
- again.nice.arg=value4
- ...
- nth.nice.arg=value_n+1
I have no problem creating a regexp for IP address for example, but I can't create one that would match this whole stuff. So far my best bet was:
\w+[ ]{1}\w+[ ]{1}[-]{1}(\w+[=]{1}\w+){+}
Lots of problems. For example \w+ won't match '.' chars but they will be there for sure. Or for another example: mode can have one of the following options:
- create
- update
- clear
I'm kinda shot even at the first problem not to mention the second.
Thanks for every help! - Joey