How to nest a function into a function?

Questions and answers on how to get the most out of FFAStrans
Post Reply
ThomasM
Posts: 113
Joined: Wed Feb 22, 2017 6:36 am

How to nest a function into a function?

Post by ThomasM » Wed Sep 11, 2019 9:02 am

Hi,
(yes.... it's me again...)

So, I want to RegExt() a Read() function in Populate-Variables-Node:

%s_MyExtractedVariable% = $regext($read("%s_original_path%\%s_archnumber%\FPS.fps")),[^\r\n]+)

but I cannot get it to work.

This function is meant to read the content of a text-file (FPS.fps). This textfile has only one Line of text but it has LF/CR at the end of the line. I only need the text - without the LF / CR.

Any idea...?

thanks in advance,
tom

emcodem
Posts: 369
Joined: Wed Sep 19, 2018 8:11 am

Re: How to nest a function into a function?

Post by emcodem » Wed Sep 11, 2019 9:47 am

@momocampo what do you think?

momocampo
Posts: 323
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: How to nest a function into a function?

Post by momocampo » Wed Sep 11, 2019 11:07 am

Hello,
Damn...
If "LF/CR" is always at the end maybe we can use :
/(\w+) /
I 'm right?

cheers.

EDIT : Maybe more that : /(\w+\s+)((LF\/CR))*/
NB :Encodem you are so cruel with me...

ThomasM
Posts: 113
Joined: Wed Feb 22, 2017 6:36 am

Re: How to nest a function into a function?

Post by ThomasM » Wed Sep 11, 2019 12:03 pm

Hi ;) ,

:idea: :idea: :idea:
Got it:

$regext($read("%s_original_full%"),"(.+)")

Hours of try and error... and it is so easy... Horror for a 1980ies BASIC kid like me...

@emcodem
@momocampo
thank you anyway!

cheers,

tom

emcodem
Posts: 369
Joined: Wed Sep 19, 2018 8:11 am

Re: How to nest a function into a function?

Post by emcodem » Wed Sep 11, 2019 12:49 pm

Congrats Thomas!
@momocampo yeah, sorry... this time i tricked you out, i feared you were going to concetrate on the regex instead of the syntax of the command that Thomas Posted ;-)

Basically anything that is not a function (like $read or $regext) needs to be enquoted into doublequotes - but only in processors/inputs that accept functions ^^

momocampo
Posts: 323
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: How to nest a function into a function?

Post by momocampo » Wed Sep 11, 2019 1:03 pm

Hé hé don't worry Encodem, I knew about doublequotes (I didn't see in fact) but I wrote only the second part of function, the part of regex.
Anyway, I'm afraid not to be enough good yet...I need a lot of training.
@Thomas : Good to hear if all is ok

;)

admin
Site Admin
Posts: 1252
Joined: Sat Feb 08, 2014 10:39 pm

Re: How to nest a function into a function?

Post by admin » Wed Sep 11, 2019 4:49 pm

$regext($read("%s_original_full%"),"(.+)") should actually be $regext("$read("%s_original_full%")","(.+)") in case the $read() returns a comma ',' character.

@emcodem, single quotes will also work: $regext('$read('%s_original_full%')','(.+)')

So the rule inside a function is: Everything that is or will end up as text string should be encapusalted with double or single quotes.

-steinar

Post Reply