Wednesday, 15 May 2013

regex - In Word 2013, wildcard that matches beginning of the document -



regex - In Word 2013, wildcard that matches beginning of the document -

in word 2013, using search , replace or without wildcards enabled, want replace each occurrence of hello @ origin of paragraph bye.

the search pattern:

^phello

only works non-first line , not match hello @ origin of first paragraph of document.

how can match hello @ origin of document? in perl done s/^hello/bye/.

wildcard match origin of document seems not exist.

what did add together paragraph mark @ start of document, searches, remove paragraph mark. here how looks in perl:

my $word = win32::ole->new ('word.application', 'quit') or die $!; $word->selection->homekey ({unit => wdstory}); # origin of doc $word->selection->typetext ({text => "\n"}); # add together ^p $word->selection->homekey ({unit => wdstory}); # origin of doc $search = $document->content->find; $search->{text} = "^phello"; $search->replacement->{text} = "^pbye"; $search->execute (); $word->selection->delete; # delete ^p

regex vba ms-word word-vba

No comments:

Post a Comment