How to find 12 digit number and just remove it

A swapping-ground for Regular Expression syntax

How to find 12 digit number and just remove it

Postby stfrancis » Wed Aug 03, 2016 8:17 pm

Hi,

Great program! Saving me tons of time!

I can't figure out how to find 12 digit UPC codes in the middle of a bunch of file names and just remove the digits from the file name. Here is a sample file name:

2020 NR201 IV 8x11 099446363848 CR01

I want to remove the 099446363848 number from the file name so that it just returns as:

2020 NR201 IV 8x11 CR01

If I enter the following to match:

[0-9]{12}

It produces a match, but I am getting stuck at the Replace field. if I enter in anything here it just replaces it with what ever I type in. For example, \1 just renames the file name as \1

Am I supposed to write something else?

Any pointers would really help.

Thanks!
stfrancis
 
Posts: 2
Joined: Wed Aug 03, 2016 8:11 pm

Re: How to find 12 digit number and just remove it

Postby therube » Wed Aug 03, 2016 9:37 pm

(Real quick & without testing...)

1:Regex

Code: Select all
Match:  (.*)[0-9]{12}(.*)
Replace:  \1\2

(And there's an extra space in there...)
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: How to find 12 digit number and just remove it

Postby stfrancis » Thu Aug 04, 2016 6:03 pm

Thanks! That did the trick!
stfrancis
 
Posts: 2
Joined: Wed Aug 03, 2016 8:11 pm


Return to Regular Expressions