Reg Ex help

Aaron Barclay aaronb at
Thu May 11 19:58:24 CEST 2006

Hi don,

there may well be a better way then regex, although I find them usefull 
and use them a lot.

The way they work would be dependant on knowing some things. For 
example, if the dir you are after is always 4
deep in the structure you could try something like...

path =  

from /main/parallel_branch_1/release_branch_1.0/4'

p = re.compile('/\S*/\S*/\S*/(\S*)/')
m =, path)
if m:

This is a good reference...

Hope that helps,

don wrote:

>I have a string  from a clearcase cleartool ls command.
>from /main/parallel_branch_1/release_branch_1.0/4
>I want to write a regex that gives me the branch the file was
>checkedout on ,in this case - 'dbg_for_python'
>Also if there is a better way than using regex, please let me know.
>Thanks in advance,

More information about the Python-list mailing list