JSFiddle - React, Tailwind, and code Playground

HTML

<input type="text" id="text1" value="https://localhost/inc/Pega/Some.pdf or inc/Pega/Some.pdf" size="100px" />

JavaScript

url = $('#text1').val();
if(url.indexOf('https:') == 0)
      $('#text1').val(url.substring(url.indexOf('inc/Pega')));