Skip to main content
Question

Split an attribute into two groups: Numbers and letters

  • October 15, 2013
  • 5 replies
  • 175 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
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

takashi
Celebrity
  • 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.