docs.org.apache.nifi.processors.standard.ExtractText.additionalDetails.html Maven / Gradle / Ivy
ExtractText
Usage Information
The Extract Text processor provides different results based on whether named capture groups are enabled.
Example
Here is a like for like example that illustrates this.
Data
foo\r\nbar1\r\nbar2\r\nbar3\r\nhello\r\nworld\r\n
Without named capture groups
Configuration
Property Name
Property Value
regex.result1
(?s)(.*)
regex.result2
(?s).*(bar1).*
regex.result3
(?s).*?(bar\\d).*
regex.result4
(?s).*?(?:bar\\d).*?(bar\\d).*?(bar3).*
regex.result5
(?s).*(bar\\d).*
regex.result6
(?s)^(.*)$
regex.result7
(?s)(XXX)
Results
Attribute Name
Attribute Value
regex.result1
foo\r\nbar1\r\nbar2\r\nbar3\r\nhello\r\nworld\r\n
regex.result2
bar1
regex.result3
bar1
regex.result4
bar2
regex.result4.0
foo\r\nbar1\r\nbar2\r\nbar3\r\nhello\r\nworld\r\n
regex.result4.1
bar2
regex.result4.2
bar3
regex.result5
bar3
regex.result6
foo\r\nbar1\r\nbar2\r\nbar3\r\nhello\r\nworld\r\n
regex.result7
With named capture groups
Configuration
Property Name
Property Value
Enable named group support
True
regex.result1
(?s)(?<ALL>.*
regex.result2
(?s).*(?<BAR1>bar1).*
regex.result3
(?s).*?(?<BAR1>bar\d).*
regex.result4
(?s).*?(?:bar\d).*?(?<BAR2>bar\d).*?(?<BAR3>bar3).*
regex.result5
(?s).*(?<BAR3>bar\d).*
regex.result6
(?s)^(?<ALL>.*)$
regex.result7
(?s)(?<MISS>XXX)
Results
Attribute Name
Attribute Value
regex.result1
foo\r\nbar1\r\nbar2\r\nbar3\r\nhello\r\nworld\r\n
regex.result2.BAR1
bar1
regex.result3.BAR1
bar1
regex.result4.BAR2
bar2
regex.result4.BAR2
bar2
regex.result4.BAR3
bar3
regex.result5.BAR3
bar3
regex.result6.ALL
foo\r\nbar1\r\nbar2\r\nbar3\r\nhello\r\nworld\r\n
regex.result7.MISS