Skip to main content
Question

Split an attribute into two groups: Numbers and letters

  • October 15, 2013
  • 5 replies
  • 125 views

Forum|alt.badge.img
Hi

 

 

I have an attribute consisting of 1-4 numbers and one letter. I would like to split it into two.

 

 

Examples: 1A, 10B, 100C etc.

 

 

I have tried AttributeSplitter, but no luck yet. Hope someone can help me.

 

 

Regards,

 

Stig

5 replies

takashi
Evangelist
  • October 15, 2013
Hi Stig,

 

 

The StringSearcher transformer can do that with this regular expression, for example: ^([0-9]{1,4})([A-Z])$

 

 This expression is more lenient: ^([0-9]+)([A-Z]+)$

 

 

Takashi

Forum|alt.badge.img
  • Author
  • October 15, 2013
Thanks very much, Takashi. It works!

david_r
Celebrity
  • October 15, 2013
Hi,

 

 

just be aware that the regexp will not work if your attribute contains accents or international characters outside of the english alphabet.

 

 

David

david_r
Celebrity
  • October 15, 2013
By the way, here is my suggested modification so that it also supports accents, etc:

 

 

^([0-9]+)(.+)$

 

 

David

Forum|alt.badge.img
  • Author
  • October 15, 2013
Thanks, David. I might have special characters in the future, so it is very helpful.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings