QUOTE(deane @ 06/30/06, 09:31 AM) [snapback]241255[/snapback]
I don't think that there's any regular expression that can do it on its own
QUOTE(Joojaa @ 07/01/06, 01:28 AM) [snapback]241281[/snapback]
Yes there actualy is (the details of this was outlined in the post 2, please reread the therad its usefull for you, but since naughty realy wanted to work on OS paths isntead of maya paths that was also the answer)
I did read the thread. No one had responded to the poster's original question which was whether there was a regular expression which could give him the path minus the final component. I'm well aware of the "greedy" nature of REs, but the expression that you provided generates an invalid Maya path because of the trailing '|'. Try executing 'ls |pPlane1|pPlane2|" in the Script Editor and you'll find that you get a syntax error. Yes, that can be subsequently stripped off in variety of different ways, but the essential point is that there is no regular expression which will do the job by itself. If you want to use something other than just a regular expression, then there are lots of different ways of doing it.
Since making my earlier post, it has occurred to me that perhaps the simplest solution is this:
CODE
substitute("|[^|]*$", "|group1|pPlane1|pPlaneShape1", "");
// Result: |group1|pPlane1 //