2 Replies Latest reply on Apr 20, 2015 8:47 AM by BEGINNER_X

    Find Special Characters in Image Name

    BEGINNER_X Level 3

      Hi All,

       

      Request:

      1. Need to find special characters or Junk Characters in Links name (i.e., Figure$.eps, abcd?cde.jpeg etc)

      2. Links name allows only [a-z] or [A-Z] or [0-9]

      3. Links name not allows special characters like (i.e., ?, !, @, $ etc...)

      4. White Space also not allowed

       

      Very Urgent Request...

       

      Trying Code is:

       

      var myLinks = app.documents[0].links.everyItem().getElements();
      alert(myLinks.length)
      
      for(i=0; i<myLinks.length; i++)
      {
          var mySplit = myLinks[i].name.split(".");
          var myFinal = mySplit[0];
          
          for(k=0; k<myFinal.length; k++)
          {
              if(String(myFinal[k]).match(/[a-z]/g) !=null || String(myFinal[k]).match(/[A-Z]/g) !=null || String(myFinal[k]).match(/[0-9]/) !=null )
              {
                  alert(myFinal);
                  break;
                  }
              
              }
          }
      

       

      Thanks in Advance

      Siraj