Skip to main content

Using LEN() but excluding URLS in the tweet


Hello!


Currently I am trying to create a formula field to check the length of a text if it is the right length for a tweet. But I want to exclude links in the text, as Twitter always takes 23 characters for a link. So the hyperlinks in my text don’t need to be counted.


Can I make a formula to count only the text which is not part of the url?

3 replies

  • Inspiring
  • 5974 replies
  • March 18, 2022

Welcome to the Airtable community!



Probably. It depends on how complex your links are. You can use REGEX_REPLACE() to remove the links, then find the LEN() of the resulting string. The trick is finding the right regular expression for the type of links you will be including.


  • Author
  • New Participant
  • 1 reply
  • March 18, 2022
kuovonne wrote:

Welcome to the Airtable community!



Probably. It depends on how complex your links are. You can use REGEX_REPLACE() to remove the links, then find the LEN() of the resulting string. The trick is finding the right regular expression for the type of links you will be including.


All my links probably have .com, .nl or .ly in them, is it possible to exclude them using this? I am new to REGEX formulas.


  • Inspiring
  • 5974 replies
  • March 18, 2022
Marlijn wrote:

All my links probably have .com, .nl or .ly in them, is it possible to exclude them using this? I am new to REGEX formulas.



When it comes to writing formulas, especially formulas with regular expressions, you should aim for “always” rather than just “probably”. There are other issues, as will the links always be prefixed with “https://”, could there be url parameters, etc.


Reply