/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.regex.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
String s
= " *Some text* *Another text* *Yet another text* **last text**"; Pattern pattern = Pattern.compile("(?<!\\S)\\*(?!\\s)([^*]+)(?<!\\s)\\*(?!\\S)");
Matcher matcher = pattern.matcher(s);
while (matcher.find()){
System.
out.
println(matcher.
group(1)); }
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CmltcG9ydCBqYXZhLnV0aWwucmVnZXguKjsKLyogTmFtZSBvZiB0aGUgY2xhc3MgaGFzIHRvIGJlICJNYWluIiBvbmx5IGlmIHRoZSBjbGFzcyBpcyBwdWJsaWMuICovCmNsYXNzIElkZW9uZQp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlTdHJpbmcgcyA9ICIgICAgKlNvbWUgdGV4dCogICAqQW5vdGhlciB0ZXh0KiAqWWV0IGFub3RoZXIgdGV4dCogICAgICAgICoqbGFzdCB0ZXh0KioiOwoJCVBhdHRlcm4gcGF0dGVybiA9IFBhdHRlcm4uY29tcGlsZSgiKD88IVxcUylcXCooPyFcXHMpKFteKl0rKSg/PCFcXHMpXFwqKD8hXFxTKSIpOwoJCU1hdGNoZXIgbWF0Y2hlciA9IHBhdHRlcm4ubWF0Y2hlcihzKTsKCQl3aGlsZSAobWF0Y2hlci5maW5kKCkpewoJCQlTeXN0ZW0ub3V0LnByaW50bG4obWF0Y2hlci5ncm91cCgxKSk7IAoJCX0gCgl9Cn0=