Test a string to see if it contains http:// or https://

I’ve been trying to find a way to test if a string contains http:// or https:// but haven’t been able to find a way to do this. Can anyone help please or point me in the right direction?

Background on what I’m trying to achieve:
I’m using the EasyDocs theme and I want to put a path for the logo to get it from my static folder. I managed to do this by modifying the theme code to use get_url(path=config.extra.logo) instead of just config.extra.logo. But this makes it incompatible with full URLs like https://easydocs.codeandmedia.com/logo.svg which was the default in the theme. I’m trying to find a way to support either option (that is full URL or link to file in static), and the first thing I’ve been able to come up with is using a search on the string to find out if it starts with http or has http:// or https://. But I can’t quite understand how to do “starts with” or “contains” and haven’t been able to find anything after searching.

Finally found it in the Tera documentation - https://tera.netlify.app/docs/#starting-with

Excerpt from page:


Returns true if the given variable is a string and starts with the arg given.


{% if path is starting_with("x/") %}
    In section x
{% endif %}