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
alopre...@apache.org
alopresto.apa...@gmail.com
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On Apr 12, 2017, at 9:40 AM, Mika Borner <n...@my2ndhead.com> 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>
> 
> 
> 
> 
> 
> 

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to