No problem :-)

Ok, it works. And now I also understand how the regex is applied.

Thanks!

Mika>


On 04/12/2017 06:46 PM, Andy LoPresto wrote:
Mika,

Apologies, that autocorrected to “Mike”.

Andy LoPresto
[email protected] <mailto:[email protected]>
/[email protected] <mailto:[email protected]>/
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

On Apr 12, 2017, at 9:46 AM, Andy LoPresto <[email protected] <mailto:[email protected]>> wrote:

Hi Mike,

If you want to replace “value1” only when it is preceded by “key=“ and have the result be “key=replacementvalue1”, try this pair of configuration values:

regex: (?<=key=)(\S+)
matching group: 1

The (?<=…) construction is a lookbehind, so the provided sequence will only match if it follows this, but won’t capture it as part of the match.

Andy LoPresto
[email protected] <mailto:[email protected]>
/[email protected] <mailto:[email protected]>/
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

On Apr 12, 2017, at 9:40 AM, Mika Borner <[email protected] <mailto:[email protected]>> wrote:

Hi all

I'm not sure I understand how the ReplaceTextWithMapping processor works. Let's say my flowfile content looks like:

   xyz key=value1 foo bar value1

My mapping file looks like:

   value1    replacementvalue1

   value2    replacementvalue2

I just want to replace the occurrence of "value1" only when it's perpended with "key=". Therefore I'm writing the Regex "key=(\S+)" and a "Matching Group" of 1.

This unfortunately doesn't work.

Can someone explain, what's wrong?

Thanks!

Mika>









Reply via email to