Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Regex help for RouteOnContent processor

avatar
Master Collaborator

Hello Experts,

 

I am looking for a regex to configure in "RouteOnContent" processor of Nifi so that based on specific string in flow file content I can route FF.

 

FF content :

● rclone.service - Rclone(file transfer tool) Remote Service
   Loaded: loaded (/etc/systemd/system/rclone.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2022-02-03 09:46:01 UTC; 6h ago
 Main PID: 23647 (rclone)
    Tasks: 13
   Memory: 61.3M
      CPU: 5.143s
   CGroup: /system.slice/rclone.service
           └─23647 /usr/bin/rclone rcd --rc-no-auth --rc-job-expire-duration=60m --cache-tmp-upload-path=/tmp/rclone/upload

 

I want to search for the string "Active: active (running)" in flow file content, if present route to different path.

 

I tried few regex but did not work as expected.

 

Any suggestion would be much appreciated.

 

Thanks

Mahendra

2 REPLIES 2

avatar
Expert Contributor

Those parentheses on your search would be considered special characters ina. regular expression unless escaped.

I can get this to work using this:

 

Active: active \(running\)

 

avatar
Super Guru

What @DigitalPlumber said.

Also make sure that Match Requirement is set to "content must contain match", otherwise it won't work.

--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs up button.