regex - What does this regular expression mean in android augmented reality? -


i found program in android claim return marker position in ar.(ar_speaker) program claim use native code (jni). problem in markerinfo class regular expression used cant understand it's mean: "^id=(\d+):name=(.+):pos\[0\]=([\d.]+):pos\[1\]=([\d.]+)$"

public class markerinfo implements serializable { private static final long serialversionuid = 1l; private static final pattern regex = pattern.compile("^id=(\\d+):name=(.+):pos\\[0\\]=([\\d.]+):pos\\[1\\]=([\\d.]+)$"); private integer id; private string filename; private float[] pos = new float[3];  public markerinfo(string markerstr) {     matcher m = regex.matcher(markerstr);     if (!m.find()) throw new runtimeexception("not markerinfo string : " + markerstr);     id = integer.parseint(m.group(1));     filename = m.group(2);     pos[0] = float.parsefloat(m.group(3));     pos[1] = float.parsefloat(m.group(4));     //pos[2]=float.parsefloat(m.group(5)); }  public integer getid() {     return id; }  public string getfilename() {     return filename; }  public float[] getpos() {     return pos; } 

}

my other question these data stored?have pattern used in ar have these data? in file?(for example in marker.patt?)

in regular expressions ^ means "start of expression or deny character in case start of expression", expression looking in markerstr, looking characters "id=" followed 1 or more decimal characters followed ":name=" followed group 1 or more characters of kind (thats .+ mean) followed ":pos[0]=" followed 1 or more decimal characters or dot (thats [\d.]+ mean) followed "pos[1]=" followed 1 or more decimal characters or dot (thats [\d.]+ mean) , $ means end of regular expression...

hope help, , anyway recommed read regex, extremely tool find patterns in string, that's using in case...

regards!


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

mysql - Pass value between different pages (form) with PHP -