Search for '{{search_term}}'

Exercise: Split file path using regex

CMOS is the Code-Maven Open Source podcast that also includes video interviews. Subscribe to this feed RSS feed with your Podcast listener app or via iTunes iTunes.

Write two functions.

Given a path like /home/foo/.mozilla/cache/data.txt, one of the functions will return the filename (data.txt), the other function will return the full-path directory name (/home/foo/.mozilla/cache).

Handle also the case of c:\home\foo\.mozilla\cache\data.txt.


In the comments, please wrap your code snippets within <pre> </pre> tags and use spaces for indentation.
comments powered by Disqus