DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Robert Guest

    Regular Expression


    I've attempted to develop a regular expression to extract a file name from
    a file path without any success!

    For example, from the following file path I wish to extract the following
    string:

    input string: c:\temp\foo.txt
    extract: foo

    or

    input string: c:\temp\foo\g1232.jpg
    extract: g1232

    Any ideas

    Robert

  2. #2
    Russell Jones Guest

    Re: Regular Expression

    You'll find it much easier to use the Path class'
    GetFilenameWithoutExtension method.


    "Robert" <qbert@hotmail.com> wrote in message
    news:3f16c120$1@tnews.web.devx.com...
    >
    > I've attempted to develop a regular expression to extract a file name from
    > a file path without any success!
    >
    > For example, from the following file path I wish to extract the following
    > string:
    >
    > input string: c:\temp\foo.txt
    > extract: foo
    >
    > or
    >
    > input string: c:\temp\foo\g1232.jpg
    > extract: g1232
    >
    > Any ideas
    >
    > Robert




  3. #3
    Robert Guest

    Re: Regular Expression


    If possible, I would like to extract the aforementoined during a transform
    from within an XSL template, using XPath's regex functions.....


    "Russell Jones" <arj1@nospam.northstate.net> wrote:
    >You'll find it much easier to use the Path class'
    >GetFilenameWithoutExtension method.
    >
    >
    >"Robert" <qbert@hotmail.com> wrote in message
    >news:3f16c120$1@tnews.web.devx.com...
    >>
    >> I've attempted to develop a regular expression to extract a file name

    from
    >> a file path without any success!
    >>
    >> For example, from the following file path I wish to extract the following
    >> string:
    >>
    >> input string: c:\temp\foo.txt
    >> extract: foo
    >>
    >> or
    >>
    >> input string: c:\temp\foo\g1232.jpg
    >> extract: g1232
    >>
    >> Any ideas
    >>
    >> Robert

    >
    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links