LAMDA to find last instance of a search string within another string

%3CLINGO-SUB%20id%3D%22lingo-sub-2597126%22%20slang%3D%22en-US%22%3ELAMDA%20to%20find%20last%20instance%20of%20a%20search%20string%20within%20another%20string%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2597126%22%20slang%3D%22en-US%22%3E%3CP%3ECan%20some%20one%20help%20covert%20the%20below%20to%20a%20lambda%20function%20using%20recursion%3C%2FP%3E%3CP%3EI%20am%20aware%20that%20this%20is%20possible%20using%20SUBSTITUTE%20-%20I%20was%20just%20wondering%20how%20to%20get%20LAMDBA%20to%20exit%20on%20Error%20when%20it%20is%20used%20recursively%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheers%20Sam%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Picture1.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F299722i762880822A4DC28F%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Picture1.png%22%20alt%3D%22Picture1.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2597126%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2598104%22%20slang%3D%22en-US%22%3ERe%3A%20LAMDA%20to%20find%20last%20instance%20of%20a%20search%20string%20within%20another%20string%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2598104%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F798351%22%20target%3D%22_blank%22%3E%40Sameer_Bhide%3C%2FA%3E%26nbsp%3B%20It%20occurred%20to%20me%20later%20that%20the%20new%20ISOMITTED%20function%20could%20make%20this%20inner-loop%20structure%20unnecessary%3B%20had%20used%20it%20so%20that%20outer%20function%20only%20needed%20two%20parameters%20and%20the%20inner%20function's%20array%20argument%20wasn't%20needed%20to%20be%20a%20blank%20parameter.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22tboulden_0-1627926273746.png%22%20style%3D%22width%3A%20966px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F299946i91EE99BC0A36C9B2%2Fimage-dimensions%2F966x384%3Fv%3Dv2%22%20width%3D%22966%22%20height%3D%22384%22%20role%3D%22button%22%20title%3D%22tboulden_0-1627926273746.png%22%20alt%3D%22tboulden_0-1627926273746.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2597523%22%20slang%3D%22en-US%22%3ERe%3A%20LAMDA%20to%20find%20last%20instance%20of%20a%20search%20string%20within%20another%20string%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2597523%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F933333%22%20target%3D%22_blank%22%3E%40tboulden%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EOh%20Wow%20!!!%26nbsp%3B%20Thanks%20-%20I%20was%20struggling%20with%20this%20problem%20for%20quite%20some%20time%20and%20your%20solution%20is%20going%20to%20take%20most%20part%20of%20today%20for%20me%20to%20figure%20out.%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EAlso%20a%20great%20way%20of%20showing%20now%20the%20new%20Lambda%20helper%20functions%20(SCAN%20in%20this%20case)%20leads%20to%20a%20more%20elegant%20solution%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EThanks%20once%20again%20for%20your%20effort.%3C%2FP%3E%3CP%3ECheers%3CBR%20%2F%3ESam%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2597325%22%20slang%3D%22en-US%22%3ERe%3A%20LAMDA%20to%20find%20last%20instance%20of%20a%20search%20string%20within%20another%20string%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2597325%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F798351%22%20target%3D%22_blank%22%3E%40Sameer_Bhide%3C%2FA%3E%26nbsp%3B%26nbsp%3B%20Please%20see%20attached%2C%20or%20transcribe%20from%20below%20snapshot.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22tboulden_1-1627840701816.png%22%20style%3D%22width%3A%20730px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F299764i23E9AB2EE263110E%2Fimage-dimensions%2F730x443%3Fv%3Dv2%22%20width%3D%22730%22%20height%3D%22443%22%20role%3D%22button%22%20title%3D%22tboulden_1-1627840701816.png%22%20alt%3D%22tboulden_1-1627840701816.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Contributor

Can some one help covert the below to a lambda function using recursion

I am aware that this is possible using SUBSTITUTE - I was just wondering how to get LAMDBA to exit on Error when it is used recursively

 

Cheers Sam

Picture1.png

3 Replies

@Sameer_Bhide   Please see attached, or transcribe from below snapshot.

 

tboulden_1-1627840701816.png

 

 

@tboulden 

Oh Wow !!!  Thanks - I was struggling with this problem for quite some time and your solution is going to take most part of today for me to figure out.


Also a great way of showing now the new Lambda helper functions (SCAN in this case) leads to a more elegant solution


Thanks once again for your effort.

Cheers
Sam

@Sameer_Bhide  It occurred to me later that the new ISOMITTED function could make this inner-loop structure unnecessary; had used it so that outer function only needed two parameters and the inner function's array argument wasn't needed to be a blank parameter.

 

tboulden_0-1627926273746.png