How to Filter Titles with More Than One '&'

Hi,

I’m generating titles using ChatGPT, and I want to ensure that each title meets the following conditions:

The total character count should not exceed 140.
The title should include no more than one & character.

I’ve successfully used the length() function filter to enforce the character limit. However, I’m struggling to create a filter that checks if the title contains more than one &. If it does, I want the scenario to regenerate the title.

Does anyone have a suggestion on how to implement this filter for counting & characters?

Thanks!

You can generate more than one title. Then use the first one <= 140 characters.

After that, you can simply force an error to terminate the scenario.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

Hi @samliew ,

Thanks for your response but this is not what i wanted. I want to filter out special character “&” in the title. if there is more than two special chracter “&” used, chat gpt should regenrate it.