Home > OS >  Find and Replace multiple digits with the last character in notepad
Find and Replace multiple digits with the last character in notepad

Time:07-25

Does anyone know how to replace several different Digits all at once in notepad .

For example, I have 4 different Digits;

1000x1000.jpg
750x750.jpg
1000x750.jpg
750x1000.jpg

I want the result like this:

1000x1000.jpg 1000
650x550.jpg 650
1200x850.jpg 1200
350x1300.jpg 350

I was trying to select each first digit and make them in groups with this Regex:

([0-9]{4}x [0-9]{4}.jpg)|([0-9]{3}x [0-9]{4}.jpg)|([0-9]{3}x [0-9]{3}.jpg)|([0-9]{4}x [0-9]{3}.jpg)

But I can't replace them after .jpg

CodePudding user response:

You can use

^(\d )x\d \.jpg$

Replace with $0 $1.

See the enter image description here

CodePudding user response:

I would like to add humbly previously posted code. Because just added "concat" function and simple code.

 select col,concat(col,regexp_replace(col,'^(\d )x(\d )\.jpg','\1')) as c from 
(   select '1000x1000.jpg ' as col from dual union all
    select '650x550.jpg ' as col from dual union all
    select '1200x850.jpg ' as col from dual union all
    select '350x1300.jpg ' as col from dual
)
  • Related