I’ve coded that in python but the language doesn’t matter here:
pattern = re.compile("^params:([0-9]+)$")
f = open(in_file, 'r')
try:
while True:
v = f.readline()
if not v:
break
found = pattern.search(v)
if found:
pdb.gimp_message(str(found.group(1)))
break
finally:
f.close()
The problem is that the regexp validates:
params:0
params:01654
params:000000000000
and I don’t want them to be valid, so I have to add this condition: if found.group(1)>0: and I was thinking: maybe a smart regular expression could avoid this.
Any idea?
If I understood correctly, the only condition is that there shouldn’t be a zero at the start.