Mar 18, 2022 07:08 AM
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?
Mar 18, 2022 07:18 AM
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.
Mar 18, 2022 07:37 AM
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.
Mar 18, 2022 07:42 AM
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.