Results 1 to 2 of 2

Thread: Regular expression validation??

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Posts
    183

    Regular expression validation??

    I have a file upload box and I want to make sure that the file listed in the file path is a .doc file. I was trying to use the validate expression "^[\w-]+\.(doc)$" but that doesn't work because the file path may contain a series of slashes (eg. "C:/Files/file.doc").

    Any ideas how ti make this work??

  2. #2
    Hyperactive Member SoftwareMaker's Avatar
    Join Date
    Mar 2001
    Location
    Elbonia with Dilbert and Wally
    Posts
    322
    I may not have the answer to this BUT what you are looking for is to let the compiler take the "C:/temp/Somefile.xls" literally.

    Try adding a @ === (@"C:/temp/Somefile.xls"). I havent tried it before BUT i read it on MSDN that the @ directive instructs the C# compiler to take the literal sense of it.

    Let me know if it works

    hth
    William T
    Software Architect / Chief Software Developer
    Softwaremaker.Net Pte Ltd
    http://www.Softwaremaker.net

    *** Things are always the darkest before they go pitch black ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width