How to transfer wildcards from FIND to REPLACE
-
I have a group of dates where i want to make into a comma delimited file and i can FIND the range with something like “Feb/1.” as a Regular Expression. With that, i can find Feb/10, Feb/11, Feb/12, Feb/13, ect, but i dont know the syntax to translate that wildcard (.) over to the REPLACE field. If i FIND “Feb/10” I want it replaced with “Feb/10,”. Each element needs to be represented in the replace expression. All the answers i have found focus on the FIND expression.
-
FIND =
Feb/1.
REPLACE =${0},
SEARCH MODE = regular expressionThe
$0
or${0}
in the replacement means “use theenterentire string found in FIND as part of the replacement”. This is documented in the npp-user-manual.org’s [Searching > Regular Expressions > Substitution section. -
@danny-spence You should try to describe in a more precise and complete way all the types of strings you wanted altered. If you are happy doing a separate F&R operation for every date of interest, that’s what Peter’s solution provides. If you wish to alter every Feb date, you need something like
Feb/\d+
. If you wish to alter a restricted range of dates in Feb like say 8th to 23th, you need something a bit more complex. If you wish to alter every date in the format you’ve shown, you need something like(Jan|Feb|..etc..|Dec)/\d+
. Try to eliminate the need for your readers to do guesswork.