Page 1 of 1

Add a space between a letter and a number/letter and a symbo

PostPosted: Sun Mar 24, 2013 4:17 am
by prushnix
Hello,

I have been using the software for some file renaming and I would like to know whether it is possible to add a space between a letter and a number as well as between a letter and a symbol.

Ex:-Original New
abc123 abc 123
abc-123 abc -123 or abc 123 (where the symbol is removed which is even better)

Checking the Word Space adds spaces only between words starting in Capital letters.

thank you

Re: Add a space between a letter and a number/letter and a symbo

PostPosted: Mon Mar 25, 2013 2:43 pm
by Stefan
prushnix wrote:Ex:-Original New
abc123 abc 123
abc-123 abc -123 or abc 123 (where the symbol is removed which is even better)


PLEASE remember to work with copies of your files. Always have an backup.


FROM:
abc123
TO:
abc 123
USE:
RegEx(1)
Match: '(.+[a-z])(\d.+)'
Repla: '\1 \2'

Means: add an blank between \1 and \2.

For upper case ABC123 use '(.+[A-Z])(\d.+)'

Please note that BRU only replace one occurrence on each run. So you may have to run this more then one time.


- - -

For symbols use this

FROM:
abc-123
TO:
abc 123
USE:
Repl.(3)
Repla: '-'
With: ' '

Means: replace with an blank.

_

Re: Add a space between a letter and a number/letter and a symbo

PostPosted: Tue Mar 26, 2013 4:35 am
by prushnix
HI Stefan,

I typed (basically copy and pasted exactly as you said, but in both instances it doesn't seem to work.
I have put the print screens for the instances I'm talking about.

Also can it work for different type of letter number combinations ?(I forgot to mention that earlier)
Ex :-
Old New
abc123 abc 123
def789 def 789

[img]
https://sphotos-b.xx.fbcdn.net/hphotos-snc7/300723_10152663067785321_1915233668_n.jpg
[/img]

thanks for the help

[img]
https://sphotos-a.xx.fbcdn.net/hphotos-ash3/577655_10152663067735321_1848400129_n.jpg
[/img]

Re: Add a space between a letter and a number/letter and a symbo

PostPosted: Tue Mar 26, 2013 7:54 am
by Stefan
Of course you have to use this expressions without the quotes.

And; the regex match any single char in the range between a and z or A and Z, followed by one digit. So no matter which chars to match.

Re: Add a space between a letter and a number/letter and a symbo

PostPosted: Tue Mar 26, 2013 2:57 pm
by prushnix
Hi Stefan,

I just checked it out and it works like a charm.
I'm not used to these type of code writing so sorry for all the trouble. :)
But you saved me a lot of time.

so thank you again :D

Re: Add a space between a letter and a number/letter and a symbo

PostPosted: Tue Mar 26, 2013 3:24 pm
by prushnix
Hey one more question.

Is it possible to add a space between a symbol and a number and/or symbol and a letter instead of replacing the symbol with a space?

Old New
abc-123 abc- 123
def#456 def# 456
789@gha 789@ gha
367&lmn 367& lmn

thank you

Re: Add a space between a letter and a number/letter and a symbo

PostPosted: Tue Mar 26, 2013 5:24 pm
by Stefan
prushnix wrote:Hey one more question.

Is it possible to add a space between a symbol and a number and/or symbol and a letter instead of replacing the symbol with a space?

Old New
abc-123 abc- 123
def#456 def# 456
789@gha 789@ gha
367&lmn 367& lmn

thank you


You mean something like
Repl.(3)
Repla: '#'
With: '# '


To match exactly only between letter and digit use RegEx
RegEx(1)
Match: '(.+[a-z])([-#@&])(\d.+)'
Repla: '\1\2 \3'

Explanation:
(.+[a-z]) ==> match one-or-more of any sign till one lower case letter of the group a-till-z
([-#@&]) ==> match one of the group out of '-', '#', '@' and '&'
(\d.+) ==> match one digit, followed by one-or-more of any sign
Replace by what is matched by first (...) group with '\1', then \2, then the wanted space followed by '\3'

Hope make sense?

Re: Add a space between a letter and a number/letter and a symbo

PostPosted: Wed Mar 27, 2013 9:44 pm
by prushnix
Hi Stefan,

Yes it made a lot if sense.

Actually what I was looking for was something like the second command.

To match exactly only between letter and digit use RegEx
RegEx(1)
Match: '(.+[a-z])([-#@&])(\d.+)'
Repla: '\1\2 \3'

and it works perfectly.

thank you again for your help. :)