i want search selection integers , increment each value, such 1. example, in following text u.s. patent no. 6,293,874, want make replacements double brackets indicate deletions , italics indicate insertions:
"in accordance present invention, amusement apparatus provided includes user-operated , controlled apparatus self-infliction of repetitive blows user's buttocks including plurality of rotating arms bearing flexible extensions self-paddling user's buttocks b. [the drawings show an] amusement apparatus [[10]] 11 self-paddling user u. illustrated in [the drawings] self-paddling apparatus [[10]] 11 includes display platform [[12]] 13 having hollow interior , having first end [[14]] 15 portion , second end [[16]] 17 portion. platform [[12]] *13*is constructed of materials adequate support weight of @ least few people standing on platform, such user , observer. in 1 embodiment, platform [[12]] 13 includes @ least 2 equally sized subunits connectable @ mid-section [[20]] 21 folding after upstanding posts mounted thereon detached. first end [[14]] 15 portion , second end [[16]] 17 portion includes storage compartments within hollow platform [[12]] 13 storage of disassembled components connectable platform [[12]] 13. first end [[14]] 15 connected @ mid-section hinges 20 second end [[16]] 17 plurality of hinges [[22]] 23. once upstanding posts , accessories detached, disassembled , stored, platform [[12]] 13 foldable , securable storage or moving next location reassembly, display, , use self-paddling."
i know how iterate on matches in match collection, whole paragraphs, viz.
for each para in selection.paragraphs txt = para.range.text offset = 0 'any match? if re.test(txt) 'get matches set allmatches = re.execute(txt) each m in allmatches num = m.value + 1 set rng = para.range rng.collapse wdcollapsestart rng.movestart wdcharacter, m.firstindex + offset rng.moveend wdcharacter, m.length rng.text = re.replace(rng.text, num) 'account added digits: offset = offset + len(cstr(num)) - len(m.value) next m end if next para
can either (a) modify foregoing code search through selection instead of paragraphs touches (in entireties), (b) somehow use selection.find.execute:=wdreplaceall
, assured won't replace in document?* (*i have noticed if variable defined in relation selection
object , used in .text
field of selection.find
, word replace instances in document, .wrap = wdfindstop
. see word vba replace text appearing in selection uppercase)
Comments
Post a Comment