What I need to happen
I'm a novice, sorry if the question has been answered, or is very confused, but I'm having a hard time searching since I don't know what this type of operation is called.
I'm using textwrangler to create cards for my Latin Anki deck. I have a pattern like this.
puell - a / puell - ae
puell - am / puell - ās
puell - ae / puell - ārum
puell - ae / puell - īs
puell - ā / puell - īs
I want to use this as a template, so I can copy it and change the relevant parts. In this case, I want to change every instance of puell
to somewordstem
, easy enough.
Then I want to change every word(ending) after -
to some specified word.
For example (pseudo-latin):
stem - ae / stem - a
stem - ac / stem - ab
stem - ae / stem - orum
stem - ai / stem - ibus
stem - a / stem - ibus
I read in the helpfile and internet about subpatterns, but I don't want to insert a word that was already in the source, I want to insert a specified text to replace subsequent instances of each matched word.
How I'm doing it
I have this in the find-field (?P<stem>\w+)\ -\ (\w*)
This finds the words. It also creates a subpattern named stem
as well as numbered subpatterns. But what do I need to put in the replace field to get the pattern stem - end1 / stem - end2
?
That is, is it possible to use the subpatterns to replace (first occurrence of word:)\1
with (specified word:)a
and \2
with b
?
or do I have to write every line separately into the replace field, like this:
stem\ -a\ /\ stem\ -\ b
stem\ -c\ /\ stem\ -\ b