I was using a pattern in PHP that was working properly. But in Java, I have tried to convert without success.
This is the PHP Regex :
$pattern = "/^docker-pullable:\\/\\/docker-registry.default.svc:5000\\/(.*)\\/(.*)@(.*)$/";
What I tried in Java :
String pattern = "^docker-pullable:\\\/\\\/docker-registry.default.svc:5000\\\/(.*)\\\/(.*)@(.*)$";
The String :
String myString = "docker-pullable://docker-registry.default.svc:5000/project-d/mo@sha256:ed651abfd1f67130ace2b7b3a3h6hdjzpms230fee8f55b16677c4785fad88021";
The code :
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(myString);
if(m.find()){
String n1= m.group(1); // return project-d
String n2= m.group(2); // return mo
String n3= m.group(3); // return Sha
}
I do not find any converter tool from PHP to Java :( And not a doc that is simple ..
Thanks
I was using a pattern in PHP that was working properly. But in Java, I have tried to convert without success.
This is the PHP Regex :
$pattern = "/^docker-pullable:\\/\\/docker-registry.default.svc:5000\\/(.*)\\/(.*)@(.*)$/";
What I tried in Java :
String pattern = "^docker-pullable:\\\/\\\/docker-registry.default.svc:5000\\\/(.*)\\\/(.*)@(.*)$";
The String :
String myString = "docker-pullable://docker-registry.default.svc:5000/project-d/mo@sha256:ed651abfd1f67130ace2b7b3a3h6hdjzpms230fee8f55b16677c4785fad88021";
The code :
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(myString);
if(m.find()){
String n1= m.group(1); // return project-d
String n2= m.group(2); // return mo
String n3= m.group(3); // return Sha
}
I do not find any converter tool from PHP to Java :( And not a doc that is simple ..
Thanks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.