3 Replies Latest reply on Nov 9, 2015 6:19 AM by sccardais

    Help Debugging Custom Function "StripReserved"

    sccardais

      I am getting a syntax error when I try to install a custom function "StripReserved" written by Roger Biel of 2Geckos Consulting listed on Brian Dunning's site. Link to StripReserved


      I posted a comment on the Dunning site describing the problem about a week ago but no answer yet. Also went to 2Geckos site but found no mention of Roger Biel. This CF was first posted in 2012 so perhaps he's no longer with 2Geckos.


      When I try to install this custom function, FMPA returns an error, "An Operator (e.g. +, -, *,...) is expected here." starting with the opening quotation in the string, "text/javscript"> ... shown in the red text in the CF code below.

       

      There may be other errors but I can't get past this first issue.  Can anyone out there tell me how to fix this?

       

      Thank you.

       

      ---

       

      // StripReserved( text )

      // Cleans text of special characters, colors, fonts, sizes, spaces, styles, and characters that may cause errors

       

       

      Case(  PatternCount ( text ; "body>" ) > 1 ;          // Remove everything except the BODY of the HTML

                     Let( [ BodyStart = Position( Text ; "<body>" ; 1 ; 1 )+6 ; BodyLen = Position ( Text ; "<script type="text/javascript">window.NREUM||(NREUM={});NREUM.info={"beacon":"bam.nr-data.net","licenseKey":"5b07c0c3c7","applicationID":"7504385","transactionName":"YlMEMkcHV0RVAU1dWVsZMxRcSV9eWAdUVV1QREsFQBVNWFlPX0FYVkIPCVsVFlNRFlhdWhtGDhY=","queueTime":0,"applicationTime":1,"atts":"ThQHRA8dREo=","errorBeacon":"bam.nr-data.net","agent":"js-agent.newrelic.com\/nr-768.min.js"}</script></body>" ; 1 ; 1 ) - BodyStart  ]  ;

                 TrimAll ( Middle ( Text ; BodyStart ; BodyLen  ) ; 1 ; 2 ) 

                      ) ;

       

       

           // The ">" character at the beginning indicates a comment

      Left ( text ; 1 ) = ">" ; TextColor ( text ; RGB(153;102;255) ) ;   

       

       

      // Remove all other formatting

      Let( [

      text = GetAsText (  text ) ;

      text = Filter ( text ; "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklomnopqrstuvwxyz1234567890 ¶+=-_*&%$#@!{})(:;<>,.?/" ) ;

      text = TextSizeRemove ( text ) ;

      text = TextFontRemove ( text ) ;

      text = TextColorRemove ( text ) ;

      text = TextStyleRemove ( text ; AllStyles ) ;

      text = TrimAll ( text ; 1 ; 2 )  ;

       

       

      text = Substitute(  text ; [ "  " ; " " ] ; [ "¶¶¶" ; "¶" ]  )

      ] ;

       

       

      text

      )

      )

       

       

      This custom function is used in another custom function also written by Roger Biel, ValidEmail.