Replace Paremeters
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
to
This File v1.2.3
Sorry if this is a silly questions I couldn't find a answer online with a brief search.
Replace all periods before v:
This.File.v1.2.3
to
This File v1.2.3
Sorry if this is a silly questions I couldn't find a answer online with a brief search.
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: www.regular-expressions.info/lookaround.html
However note that the "lookbehind" functions mentioned in this tutorial are NOT available in the flavour of regex used by Advanced Renamer (PCRE).
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: www.regular-expressions.info/lookaround.html
However note that the "lookbehind" functions mentioned in this tutorial are NOT available in the flavour of regex used by Advanced Renamer (PCRE).
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
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
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])
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])