class Asciidoctor::PathResolver

def extract_uri_prefix str

returns a tuple containing the specified string without the URI prefix, if present, and the extracted URI prefix.

str - the String to check

the prefix is removed.
Uses the Asciidoctor::UriSniffRx regex to match the URI prefix in the specified String (e.g., http://). If present,

Internal: Efficiently extracts the URI prefix from the specified String if the String is a URI
def extract_uri_prefix str
  if (str.include? ':') && UriSniffRx =~ str
    [(str.slice $&.length, str.length), $&]
  else
    str
  end
end