yulanggong / IncrementSelection

Add a number to each selection in Sublime Text, incremented once per selection
MIT License
113 stars 10 forks source link

Group restart sequence #7

Closed stegrams closed 7 years ago

stegrams commented 7 years ago

I m not sure how - or if - it is possible (an enhancement perhaps). Here is a sample of an XML file.

<person>
  <name>Jane</name>
  <item>wallet</item>
  <item>car</item>
  <item>tv</item>
  <item>cellphone</item>
</person>
<person>
  <name>Chris</name>
  <item>pc</item>
  <item>cat</item>
</person>

I d like enumeration to restart somehow on each persons group of items like this

<person>
  <name>Jane</name>
  <item1>wallet</item1>
  <item2>car</item2>
  <item3>tv</item3>
  <item4>cellphone</item4>
</person>
<person>
  <name>Chris</name>
  <item1>pc</item1>
  <item2>cat</item2>
</person>
yulanggong commented 7 years ago

It's unable to do this.

You can replace (</name>\s+)<item>(.*)</item> with $1<item1>$2</item1>, then replace (</item1>\s+)<item>(.*)</item> with $1<item2>$2</item2>, and so on.

stegrams commented 7 years ago

Ok. Thanks for your response and for sharing