Forum Discussion

SScheibe_344275's avatar
SScheibe_344275
Icon for Nimbostratus rankNimbostratus
Mar 02, 2018

search for html text A. when not found insert html-text

Is it possible to search for a specific word with an iRule and insert it if it is not found in the html text? I know the possibilities with search and replace, but I don't know how to search for a certain text and then insert it below.

 

  • JG's avatar
    JG
    Icon for Cumulonimbus rankCumulonimbus

    You can use a stream profile to do this. If you can be more specific, you may get more help here.

     

  • You can certainly do it. Now the main challenge is where exactly in your HTML page you want to insert that "Imprint"? That's why search&replace (what stream profile does) works best. This does not require you to know the exact byte location where to insert your content. Even when you do know, any minor change in HTML layout could mess up things and you may see "Imprint" at a wrong location. If the place of insertion is always at the start or very end, that would ease things considerably. In all other scenarios, I'd refrain from using iRules, or try to find a way to go with search&replace.