Skip to main content
Question

How to extract values from comma separated list?

  • January 21, 2020
  • 2 replies
  • 354 views

Forum|alt.badge.img

Hello,

I would like to extract attributes from a text file. The texfile contains different attributes separated by comma (,). It is like:

104.474,104.474,649621.0654572968,245370.49979405673,0,0,146

I tried this regex , but it gives back . delimited values (like: 474,104)

(\\d+)(,\\s*\\d+)*

Thanks!

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.

2 replies

erik_jan
Contributor
Forum|alt.badge.img+22
  • Contributor
  • 2179 replies
  • January 21, 2020

Have a look at the AttributeSplitter transformer.

After reading the text line by line, this will get you the attribute values in a list.

Then the AttributeManager can convert them to the named attributes you want.

Hope this helps.


arnold_bijlsma
Enthusiast
Forum|alt.badge.img+15
  • Enthusiast
  • 126 replies
  • January 21, 2020

1. Try using a CSV Reader instead of TextFile Reader

2. If still needing to use a TextFile Reader, use an AttributeSplitter instead of RegEx