Russ
Russ

Reputation: 9

Regular Expressions and EditPlus

I'm using Edit Plus and have the following type of lines in a text file which represent a directory structure and a file.

\APPS\MCCSDOCS\GENERAL\10-11 ARRAT\BRIDGE RIVER_\BRIDGE RIVER-PA0900021_DEC 21.PDF
\APPS\MCCSDOCS\GENERAL\10-11 ARRAT\BURNS LAKE\BURNSLAKE_PA1100062-SE_MAR2010.XLS
\APPS\MCCSDOCS\GENERAL\10-11 ARRAT\CAMPBELL RIVER\CAMPBELLRIVER_PA0900004_ARRAT_OCT2010.PDF

What I need to do is grab the directory structure \APPS\MCCSDOCS\GENERAL\10-11 ARRAT\BRIDGE RIVER_\ and place it in buffer /1 and also grab the file name BRIDGE RIVER-PA0900021_DEC 21.PDF and place it in buffer /2.

If it is easier to start at the end of the line and grab the file name and then grab what is left, that would work too.

Upvotes: 0

Views: 2091

Answers (2)

Thm Lee
Thm Lee

Reputation: 1236

^[\s]*(.*\\)(.*\.[a-zA-Z]{3,5})[\s]*$

It seems this works in this case.

Added filename extension part \.[A-z]{3,5} and leading or trailing space checking part [\s]* of filepath string. Thanks:-)

Upvotes: 0

ISQ
ISQ

Reputation: 2893

(\\.*\\.*\\.*\\.*\\.*\\)(.*)   

\\ = literal \
.* = anything 

The result will be:

\APPS\MCCSDOCS\GENERAL\10-11 ARRAT\BRIDGE RIVER_\=======BRIDGE RIVER-PA0900021_DEC 21.PDF
\APPS\MCCSDOCS\GENERAL\10-11 ARRAT\BURNS LAKE\=======BURNSLAKE_PA1100062-SE_MAR2010.XLS
\APPS\MCCSDOCS\GENERAL\10-11 ARRAT\CAMPBELL RIVER\=======CAMPBELLRIVER_PA0900004_ARRAT_OCT2010.PDF

Is this what you want?

enter image description here

Upvotes: 0

Related Questions