Created 05-30-2025 11:05 AM
I want to filter rows of a CSV file based on a regular expression, but so far I didn't get any row as a match.
CSV:
F;0;00003;;;SA;30012025;012025;;0456;3790;4940;0;0;150.00;"- Sachbezug (sonstiger)";;;EUR
F;0;00003;;;SA;30012025;012025;;0461;3790;4949;0;0;50.00;"- Abzug Gutschein stfr.";;;EUR
G;0;00003;;;SA;30012025;012025;;0486;3790;3725;0;0;970.00;"- sonstiger Abzug";;;EUR
G;0;00003;;;SA;30012025;012025;;0487;3790;6301;0;0;50.00;"- Abzug Arbeitskleidung";;;EUR
F;0;00003;;;SA;30012025;012025;;1160;3790;6010;0;0;-25.91;"Ausgl. Zuschl.b.Krankheit";;;EUR
F;0;00003;;;SA;30012025;012025;;1161;3790;6010;0;0;-63.36;"Ausgl. Zuschl. Feiertag";;;EUR
Nifi-Workflow:
Because I don't have any permission to upload images I need to describe what the workflow looks like - sorry.
I have a GetFile processor to read the CSV file. This processor is connected directly with the 'RouteText' processor. This processor is connected via the 'unmatches' output to a disabled 'Wait' processor. An output called 'MatchedG' has been created as another property of the 'RouteText' processor. This output is connected to another disabled 'Wait' processor.
I use the disabled 'Wait' processors and to get the queues between the nodes.
The 'MatchedG' property has been created with the RegEx '^(G;)'.
The Matching Strategy has been set to 'Matches Regular Expression. All other settings are default.
I expect the two lines with the G in the first column to get routed to the 'MatchedG' output and the others to the 'unmatch' output.
Unfortunately no record matches my regular expression.
Any idea what could be the issue here ?
Created 05-30-2025 01:53 PM
The strategy "Matches Regular Expression" intends to match the entire line, but your regex only matches the first two characters. The regex "^(G;).*" will match the entire line.
Created 05-30-2025 01:41 PM
@NadirHamburg Welcome to the Cloudera Community!
To help you get the best possible solution, I have tagged our NiFi experts @MattWho @mburgess who may be able to assist you further
Please keep us updated on your post, and we hope you find a satisfactory solution to your query.
Regards,
Diana Torres,Created 05-30-2025 01:53 PM
The strategy "Matches Regular Expression" intends to match the entire line, but your regex only matches the first two characters. The regex "^(G;).*" will match the entire line.
Created 05-31-2025 03:04 AM
This indeed fixed the issue. Thanks a lot !