nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy LoPresto <alopre...@apache.org>
Subject Re: ReplaceTextWithMapping how to regex
Date Wed, 12 Apr 2017 16:46:59 GMT
Mika,

Apologies, that autocorrected to “Mike”.

Andy LoPresto
alopresto@apache.org
alopresto.apache@gmail.com
PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69

> On Apr 12, 2017, at 9:46 AM, Andy LoPresto <alopresto@apache.org> 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
> alopresto@apache.org <mailto:alopresto@apache.org>
> alopresto.apache@gmail.com <mailto:alopresto.apache@gmail.com>
> PGP Fingerprint: 70EC B3E5 98A6 5A3F D3C4  BACE 3C6E F65B 2F7D EF69
> 
>> On Apr 12, 2017, at 9:40 AM, Mika Borner <nifi@my2ndhead.com <mailto:nifi@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>
>> 
>> 
>> 
>> 
>> 
>> 
> 


Mime
View raw message