Skip to main content
Question

How to extract values from comma separated list?

  • January 21, 2020
  • 2 replies
  • 319 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!

2 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • 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+14

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


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