Patindex function in metabse

hi every one
I have a code that uses patindex inorder to find a pattrn index. but metabase does not recognize the function. any idea for replacement?
my code:

WITH cteWithoutWWW (Domain,Adress)
as
(
select

 case when PATINDEX('%www.%', "link") > 0 then
        SUBSTRING("link", PATINDEX('%www.%', "link") + 4, LEN("link") - PATINDEX('%www.%',"link"))
   else
      "link"
  end,
      "link",

  FROM "table"

)

and the error

ERROR: function patindex(unknown, character varying) does not exist Hint: No function matches the given name and argument types. You might need to add explicit type casts. Position: 197

Hi @elahe
Metabase sends the query to your database, so if the function is not available there, then the query fails.