JSFiddle - React, Tailwind, and code Playground

by Hifni Nazeer

JavaScript

$(document).ready(function () {
  // Example usage
  var uri =
    "https://jksbkyc.blob.core.windows.net/production/2024-09-19-JKB821230063VN00-RIGHTS-33b1-.jpeg"
  var blobName = getBlobNameFromUri(uri)
  console.log(blobName) // Outputs: blobname
})

function getBlobNameFromUri(uri) {
  // Create a URL object from the URI
  var url = new URL(uri)

  // Get the pathname from the URL
  var pathname = url.pathname

  // Extract the blob name from the pathname
  var blobName = pathname.substring(pathname.lastIndexOf("/") + 1)

  return blobName
}