[help] Locating space between numbers and replace with .

A swapping-ground for Regular Expression syntax

[help] Locating space between numbers and replace with .

Postby sphinxios » Sun Feb 12, 2017 8:09 am

Hi

I have tried to find/figure out on how to place a . between numbers in a folder name like "replace a space between numbers with a dot 3 0 44 1" to
"replace a space between numbers with a dot 3.0.44.1" but i havn't been able to to figure this one out so far. i am not so familiar with regex.
Many thanks in advance.
Last edited by sphinxios on Sun Feb 12, 2017 10:41 pm, edited 1 time in total.
sphinxios
 
Posts: 2
Joined: Sun Feb 12, 2017 7:55 am

Re: [help] Locating space between numbers and replace with .

Postby therube » Sun Feb 12, 2017 2:02 pm

3:Replace
Code: Select all
Replace:  {space}
With:  .  {a dot}
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: [help] Locating space between numbers and replace with .

Postby KenP » Sun Feb 12, 2017 2:11 pm

If I'm understanding this correctly you want dots between the numbers but not between the words, in which case this will work with the example you've given.

RegEx (1)
Match: (.*)(\d)\s(\d)\s(\d\d)\s(\d)
Replace: \1\2.\3.\4.\5
KenP
 
Posts: 199
Joined: Sat Jul 30, 2016 11:25 am

Re: [help] Locating space between numbers and replace with .

Postby sphinxios » Sun Feb 12, 2017 10:58 pm

@KenP

Yes you are right that is what i would like to do
the way the numbers are presented can be e a bit different from each other
and all i want is a . between them

"replace a space between numbers with a dot 3 0 44 1" to "replace a space between numbers with a dot 3.0.44.1"
"replace a space between numbers with a dot 3 00 4 1" to "replace a space between numbers with a dot 3.00.4.1"
"replace a space between numbers with a dot 3 0 44 01" to "replace a space between numbers with a dot 3.0.44.01"
"replace a space between numbers with a dot 3 00 44 001" to "replace a space between numbers with a dot 3.00.44.001"
"replace a space between numbers with a dot 3 2" to "replace a space between numbers with a dot 3.2"
"replace a space between numbers with a dot 3 0 4" to "replace a space between numbers with a dot 3.0.4"

i tried your version but i cant get it to work
i greatly appriciate your help.
sphinxios
 
Posts: 2
Joined: Sun Feb 12, 2017 7:55 am

Re: [help] Locating space between numbers and replace with .

Postby KenP » Mon Feb 13, 2017 1:47 pm

This is the most efficient way I've found of doing this.

RegEx (1)
Match: (\D*)(\d*)\s(\d*)\s?(\d*)\s?(\d*)
Replace: \1\2.\3.\4.\5

Rename <this will leave extra dots at the end of names with less than 4 sets of digits>
Reset

Filters (12)
Mask: (\.).\w\w\w$ <this will filter the files that have extra dots at the end of the file name when you click outside of the text-box>
RegEx: selected

Remove (5)
Last: <this will be 1 with names that have 3 sets of digits and 2 with names that have 3 sets of digits>
KenP
 
Posts: 199
Joined: Sat Jul 30, 2016 11:25 am


Return to Regular Expressions


cron