AnsweredAssumed Answered

Custom function help for find/replace text with style

Question asked by barrybuzz on Aug 4, 2010
Latest reply on Aug 6, 2010 by barrybuzz

Title

Custom function help for find/replace text with style

Post

Hello,

Running into trouble with my attempt at a custom function. The function needs to find in a given field this pattern:

<b>some sort of text</b>

and replace it with:

some sort of text

Here is what I have so far, but it's returning an error:

Evaluate (

Let (

[

startBold = Position ( TextAsEntered ;  "<b>" ; 1 ; 1 ) ;
endBold = Position ( TextAsEntered ; "</b>" ;  startBold+5 ; 1 ) ;
midBold = Middle ( TextAsEntered ; startBold + 5 ; endBold - startBold )

] ; //End variable definition and start calculation

If ( startBold = 0; TextAsEntered;

      // Else
    Left ( TextAsEntered ; startBold - 1 )

    & TextStyleAdd (  midBold; Bold )

    & Right ( TextAsEntered; Length ( TextAsEntered ) - endBold - 5 )

   )  //End IF

  )  //End LET

)  //End Evaluate

Any input appreciated!

BarryH

Outcomes