replace dash with space if between letters
hello
I'm very newbie at regex and I'm trying to replace "-" in filename by a " " but only if it is between letters and not if there's space or else
ex.
"Room-Camera-Screenshot - Daily.jpg"
to "Room Camera Screenshot - Daily.jpg"
seems search regex is "\w-\w" but not sure and can't find replace string
thank you for help
I'm very newbie at regex and I'm trying to replace "-" in filename by a " " but only if it is between letters and not if there's space or else
ex.
"Room-Camera-Screenshot - Daily.jpg"
to "Room Camera Screenshot - Daily.jpg"
seems search regex is "\w-\w" but not sure and can't find replace string
thank you for help
Unfortunately the definition of "word character" includes numerical digits and underscore. To match an alphabetical character only (ie a to z or A to Z) strictly you should use the regex [a-zA-Z]. However by default ARen is not case sensitive so [a-z] will be fine provided the "case sensitive" box remains clear.
Read the User Guide at
https://www.advancedrenamer.com/user_guide/regular_expresion s
Based on the information available in the User Guide...
Replace: ([a-z])-([a-z])
With: \1 \2
Case sensitive: Clear
Use regular expressions: Check
However the User Guide only contains a basic subset of regular expressions so a more advanced solution is...
Replace: [a-z]\K-(?=[a-z])
With: Space only
Here the metacharacter \K is an instruction to omit previously matched characters from the final match and x(?=y) is a "positive lookahead", which means that "x" will only be matched if it is immediately followed by "y".
For a broader introduction to regex see:
https://www.regular-expressions.info/
Bear in mind that there are different "flavours" of regex with differing limitations (for example "PCRE" - as used by ARen - does not support "lookbehind", hence the "\K" workaround above).
Read the User Guide at
https://www.advancedrenamer.com/user_guide/regular_expresion s
Based on the information available in the User Guide...
Replace: ([a-z])-([a-z])
With: \1 \2
Case sensitive: Clear
Use regular expressions: Check
However the User Guide only contains a basic subset of regular expressions so a more advanced solution is...
Replace: [a-z]\K-(?=[a-z])
With: Space only
Here the metacharacter \K is an instruction to omit previously matched characters from the final match and x(?=y) is a "positive lookahead", which means that "x" will only be matched if it is immediately followed by "y".
For a broader introduction to regex see:
https://www.regular-expressions.info/
Bear in mind that there are different "flavours" of regex with differing limitations (for example "PCRE" - as used by ARen - does not support "lookbehind", hence the "\K" workaround above).
Reply to #2:
second one works fine, thank you very much for solution and explanations, regex is very interesting and so powerful
second one works fine, thank you very much for solution and explanations, regex is very interesting and so powerful
Reply to #2:
second one works fine, thank you very much for solution and explanations, regex is very interesting and so powerful
second one works fine, thank you very much for solution and explanations, regex is very interesting and so powerful