User_defined transform using Python script to keep only alpha numeric character
Input to the User_defined transform will be a Description field which will contain invalid character set as below.
Source
Name,Description
AAA,AAdesc@1
BBB,BBdesc$1
CCC,CCdesc*&1
DDD,DDKl@£$%[};'\D
Python script to remove the invalid character and keep only alphanumeric character
-------------------------------------------------------------------------------------------------
import re
var1 = locals()
var1[u'Description'] = record.GetField( u'Description')
var1[u'Description'] = re.sub("[^a-zA-Z0-9.]","",var1[u'Description'])
record.SetField(u'New_Description',var1[u'Description'])
-------------------------------------------------------------------------------------------------
Target
DESCRIPTION,NEW_DESCRIPTION
AAdesc@1, AAdesc1
BBdesc$1, BBdesc1
CCdesc*&1, CCdesc1
DDKl@�$%[};'\D, DDKlD
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Subject | Kudos |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
User | Count |
---|---|
6 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 |