I’d like to get some values from a string.
I want to split the string based upon a regex.
Currently I have [0] as string-list and a non-regex array (IN[1]) which is just a dumb list. but works.
list1, list2=[], []
filterz = IN[1]
for i in IN[0]:
if any(n in i for n in filterz):
list1.append(i[3:5])
list2.append(i[5:8])
else:
list1.append('')
list2.append(i[3:5])
OUT=list1, list2
So I’d like the regex implemented.
import re
import clr
list1, list2=[], []
regexstring =IN[1]
filterz = re.compile(IN[1])
for i in IN[0]:
?
else:
?
OUT=list1, list2
regex input: 31.[0-9,A-Z]+[0-9]+
so “31.00”, “31.H01”, “31.Z06 some extra text”, "31.TR001"
should give me
31.00 > “”, "00"
31.H01 > “H”, "01"
31.Z06 > “Z”, "06"
31.TR001 > “TR”, “001”
Any thoughts on what nexT?