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

    Join Date
    Jul 2011
    Posts
    5
    Rep Power
    0

    Match string from x to end


    hi, i need a regex that matches a specified (reverse) position to end. strings are some file names.

    for example if the string is
    C:\New Document.extension

    and if specified position is 4, it should match
    ment
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,730
    Rep Power
    1959
    In what context/place are you going to use this regex?

    some programming language have file library, which can extract the actual filename (e.g. New Document).

    If you search on google for "regex get filename from path", it should also give you some usable results.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2011
    Posts
    5
    Rep Power
    0
    Thanks for the tip. i m using delphi 2010. i ll search for it.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2011
    Posts
    5
    Rep Power
    0
    i fixed this by (.{6})(?:\..*)?$

    now i need a regex to match from a specified position to the first letter reversely. for example if the string is
    New Document.extension
    and the given number is 4

    it should match: New Docu

IMN logo majestic logo threadwatch logo seochat tools logo