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
>Solution :
You can use
^(\d+)x\d+\.jpg$
Replace with $0 $1.
See the regex demo. Details:
^– start of string(\d+)– Group 1 ($1): one or more digitsx– anxchar\d+– one or more digits\.jpg– a.jpgstring$– end of string (line here, in Notepad++).
Note that $0 is a backreference to the whole match value. $1 refers to Group 1 value.
Regex variations
If the match does not fit the whole line, use either word (\b(\d+)x\d+\.jpg\b) or numeric/word ((?<!\d)(\d+)x\d+\.jpg\b) boundaries.
See demo:
