RegEx help

Hello,

I have a csv file with the following pattern:

2440726 G:\Bilder Test 1\1b\BIlderTest Ordner 1.JPG 24.04.2008 12:31

now I would like to change this to:

G:\Bilder Test 1\1b\BIlderTest Ordner 1.JPG

or in other words: delete everything that comes before G and everything after the extention (jpg).

Can someone please help me with this RegEx renaming.

Thanks in advance!

Hello,

try this:

replace

^\d{7}\s((G):\\.*?\.(jpg|gif))\s\d{2}\.\d{2}\.\d{4}\s\d{2}:\d{2}$

with

\1

Attention:
Because you left precious little information, I created this expression especially for your example :exclamation:
This means seven numbers at the beginning followed by a path to a file (you may add more extensions and drives) followed by a date and a time value.

If DOpus does not know something like this {7}, you have to repeat the pattern manually!

means

Opus doesn't support \d etc. either. :slight_smile: It currently uses a very simple regexp library. (Replacing it with a better one is already on the request list.)

I'm guessing this regexp isn't for use inside of Opus though so your answer is probably still good.

dp_fan, let us know where/how the regexp is being used if Dinkelhopper's one doesn't work for you.

@Dinkelhopper
I only had to change "jgp" to "JPG" and it is working now
But lets say the following:

I want to remove ALL content (numbers, letter, spaces etc) infront of the "G:......", and all the stuff after the ".jpg" any idea? I just cant find some code
I am using RegExBuddy for lerning RegEx

@Leo
First I wanted to rename a jpg in DO using the \d and nothing seemed to work inside DO. Then I used my RegEx buddy program to see if I make a mistake just testing the \d .....now that you haven mentioned its not supportet in DO, I know why, ha ha

I'm late to the dance here, but what is

2440726 G:\Bilder Test 1\1b\BIlderTest Ordner 1.JPG 24.04.2008 12:31

anyway? RegEx in Opus is primarily for renaming files, and I don't see how the above can even be a file.

Regardless, here's a quick easy RegEx for removing everything before the G:\ and after the .JPG

[code]Old Name: .(G..JPG).*

New Name: \1[/code]

Hi John,

I tried to rename a file in DO using the \d and some other things - but nothing worked in DO. Do does not support a few things in RegEx so far and I thought someone could help me anyway with RegEx.
The reason why I wanted to change that text is the following:
I am running a program, which lists me doubble files and the output is the way like in my example.
Some time ago, a DO user asked how to create a collection in DO using a tex file. I think you also took part in this. Now, by changing my text file with RegEx I am able to use the button

Anyways, thanks John - from another iMatch user!