Support Questions

Find answers, ask questions, and share your expertise

Remove ^@ from a flow file in Nifi

avatar
New Contributor

I have a file which has a bunch ^@ in it. I would like to remove these to clean up the file. I was going to use ReplaceTExt in nifi but I cant figure out the correct regex for this, any help would be appreciated. Thanks

1 ACCEPTED SOLUTION

avatar
Guru

That sounds like it could be a visual representation of a range of different control characters in the file. One thing to do would be to use a regex like [^\d\w] to greedily replace the non-ascii and non-digit characters.

View solution in original post

2 REPLIES 2

avatar
Guru

That sounds like it could be a visual representation of a range of different control characters in the file. One thing to do would be to use a regex like [^\d\w] to greedily replace the non-ascii and non-digit characters.

avatar
Super Guru

@Pat McCarthy

If you want to keep only numbers and alphas, you can use something like this:

[^0-9a-zA-Z]+

If you want also to keep some special characters like {}, you can use something like this:

[^0-9a-zA-Z{}]+

Obviously, you can add other special characters to the above regex

The following matches any non-alphanumeric characters:

[^\w\d]

Try this interactive tutorial: http://regexone.com/