How to nest a function into a function?

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

How to nest a function into a function?

Post by ThomasM »

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: 1643
Joined: Wed Sep 19, 2018 8:11 am

Re: How to nest a function into a function?

Post by emcodem »

@momocampo what do you think?
emcodem, wrapping since 2009 you got the rhyme?
momocampo
Posts: 592
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: How to nest a function into a function?

Post by momocampo »

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
Site Admin
Posts: 224
Joined: Wed Feb 22, 2017 6:36 am

Re: How to nest a function into a function?

Post by ThomasM »

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: 1643
Joined: Wed Sep 19, 2018 8:11 am

Re: How to nest a function into a function?

Post by emcodem »

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 ^^
emcodem, wrapping since 2009 you got the rhyme?
momocampo
Posts: 592
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: How to nest a function into a function?

Post by momocampo »

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: 1659
Joined: Sat Feb 08, 2014 10:39 pm

Re: How to nest a function into a function?

Post by admin »

$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