I have a set of data with more 2K+ and it contains mix of letter and numbers as it show on the sample. I need to emit the number from it and still kept the original by using the Transform node or any possible way. For example, ad71296 --> the NewField should contain = 71296...
It really depends on how complex it needs to be but Python actually supports filtering inline for DIGITS
out1.ints = str
out1 += in1
str1 = fields.dataout1.ints = int(filter(str.isdigit, str1))
As John's reply shows - there are several ways this can be done. Here is an example using regular expressions.
## ConfigureFields Script
import re#Configure all fields from input 'in1' to be mapped #to the corresponding fields on the output 'out1'out1 += in1out1.DigitsOnly = unicodepattern = r'^([a-zA-Z]+)(\d+)$'
## ProcessRecords Script
#Copy all fields from input 'in1' to the corresponding output fields#in output 'out1'. Copies the values of the fields that have been setup#in the mapping defined in the ConfigureFields propertyout1 += in1if fields.Data == Null or fields.Data == "": out1.DigitsOnly = Nullelse: match = re.match(pattern, fields.Data) if match: out1.DigitsOnly = match.group(2) else: out1.DigitsOnly = Null
thank you...appreciate the help