apache-nifi

Extract text from a file in NiFi


I have a simple use case. I have an incoming file having say user name and user address in each line. User name is from char 1 to char 5 and user address is from char 6 to char 15. How to use ReplaceText processor for it. I tried using Search Value as ^(.{5})(.{10}) and in replacement value as $1,$2

Say the file has user1Address123XyzXyzAbc So, user name should be user1 and address should be Address123.

Issue I am having is that for address it is capturing all the chars from 6th char to last and not necessarily upto 15th char. What is happening is user name comes as user1 but address comes as Address123XyzXyzAbc. What should I modify? Just for experimentation I tried doing ^(.{5})(.{10})(.{1}) and $1,$2,$3 and this is able to capture properly from 6th char to 15th char. Please help.


Solution

  • I had to update my Search Value to ^(.{5})(.{10}).* Then it was able to perform the operation properly.