Thread: File extension

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    1
    Rep Power
    0

    File extension


    I have url like this i want it to accept .pdf and .PDF

    $url =~ m|\/([\d\]*-[\d\]*\.pdf)$|;
    any help??
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Apr 2009
    Posts
    1,968
    Rep Power
    1225
    Add the 'i' modifier to the end of the regex to enable case insensitivity.

    See perldoc perlre
    It's covered under the "Modifiers" section near the top.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Location
    Paris area, France
    Posts
    843
    Rep Power
    496
    Yes, the "i" modifier will take care of letter case ( pdf or PDF or even Pdf, pDf, etc.)

    But I am not sure that this part or your regex:

    Code:
    \/([\d\]*-[\d\]*
    really does what you want it to do.

IMN logo majestic logo threadwatch logo seochat tools logo