Replace Paremeters

Advanced Renamer forum
#1 : 13/01-21 00:42
Posts: 2
Is there a way to replace a letter or symbol before a certain letter or symbol for example:

Replace all periods before v:



This File v1.2.3

Sorry if this is a silly questions I couldn't find a answer online with a brief search.

13/01-21 00:42
#2 : 13/01-21 20:23
David Lee
David Lee
Posts: 600
Easy - if you know how!

A regular expression with a "positive lookahead" will do exactly what you want...

Replace: \.(?=v)
With space
Use regular expression

"." in a regex means "match any character" so it must be "escaped" as "\." in order to represent itself
The positive lookahead "q(?=u)" means that "q" will only be matched if it is followed by "u" but "u" will not be included in the match.

There is a related "negative lookahead" "q(?!u)" which matches "q" only if not followed by "u".

For further information see:
However note that the "lookbehind" functions mentioned in this tutorial are NOT available in the flavour of regex used by Advanced Renamer (PCRE).

13/01-21 20:23 - edited 13/01-21 20:24
#3 : 14/01-21 02:03
Posts: 2
Reply to #2:

It worked!

Kind of, and wow you know your stuff lol.

So it is replacing the "." before the "v" but only if there is a "v" immediately after so it comes out looking like this:

This.File.Here v1.2.3

So it replaced the period with a space right before the v but didn't replace the other periods before it, is this possible by chance?

EDIT: So I played around with it and managed to get the results I needed with \.(?=\D)

You must be a programmer or something this stuff is nuts lol

14/01-21 02:03 - edited 14/01-21 02:20
#4 : 14/01-21 11:47
David Lee
David Lee
Posts: 600
Reply to #3:
I didn't spot that you wanted to replace "." before any alpha character.

\D will match any non-numeric character - to mach only alpha characters you can use [a-zA-Z] or simply [a-z] if you leave "Case sensitive" unchecked.

ie Replace: \.(?=[a-z])

14/01-21 11:47