I continue to dig in an effort to try and get this to work. Found this,
which made me hopeful:
https://stackoverflow.com/questions/62512560/how-to-use-regex-capturing-group-variable-in-nifi-expression-language
Essentially it says to wrap single quotes around the capture group
reference, which would get me to this:

filename         ${filename:replaceFirst('([0-9]{14})',
'*'$1'*:toDate("yyyyMMddHHmmss","UTC"):toNumber()'}


It does not like this either:
filename         ${filename:replaceFirst('([0-9]{14})',
'*${'$1'*:toDate("yyyyMMddHHmmss","UTC"):toNumber()}'}


Unfortunately it continues to choke. I don't think it likes the single
quotes in the second expression of the replaceFirst('....', '....') being
followed immediately by the single quote at the front of $1.

Jim

On Tue, Oct 4, 2022 at 11:19 AM James McMahon <[email protected]> wrote:

> I have an incoming filename that includes the pattern
> prefix20221004035958postfix. I need to convert that yMdHms to seconds since
> the epic within that filename.
>
> This is the expression I attempt to use, but it seems to choke on the
> capture group reference:
> filename         ${filename:replaceFirst('([0-9]{14})', '*$1*
> :toDate("yyyyMMddHHmmss","UTC"):toNumber()'}
>
> How do I get this to work, applying expression language functions to the
> capture group?
> Thanks.
>

Reply via email to