Search and replace question (regular expression)
Does the Search and replace function of Edit metadata allow one to conditionally insert text based on whether a capture group actually captured any text?
e.g. If I use the following regular expression in the Search for field
(January)|(February)|(March)|(April)|(May)|(June)| (July)|(August)|(September)|(October)|(November)|( December)
Can I insert the numeric value of the month by doing a conditional check to see which capture group actually captured text?
I have the TextMate editor and this can be done there by using the following Replace with string:
(?1:01)(?2:02)(?3:03)(?4:04)(?5:05)(?6:06)(?7:07)( ?8:08)(?9:09)(?10:10)(?11:11)(?12:12)
The (?#:XXXX) construct means if group # matched, insert XXXX.
Right now, I am having to do 12 separate searches to perform this task. Since I have to perform this particular search and replace on a recurring basis, it would be much easier to create a saved search and replace that performs all 12 replacements at once rather than having to do 12 separate replacements.
Any help woud be greatly appreciated.
|