In addition to what ELISHEVA said about parsing, I'd offer that you're making a simple manual task into a more difficult manual task with an intermediate programming loop.

Double clicking on the first word in the Word doc and hitting Ctrl+b will do what you say you want and without the runaround of cutting, pasting, parsing, loading, copying, pasting. So, I'm wondering if this is really what you want (emphasize the first word of the doc) or you actually have a different requirement for which this is a stand-in.

If your requirement is real, I'd suggest doing something with OpenOffice or RTF instead so you could remove (all but one of) the manual steps; you'd probably have to export to RTF first or import to OO. Both could be scripted completely and Word will open either if saved correctly. This isn't really trivial though. Ctrl+b is, if a bit repetitive. :)


In reply to Re: changing format of the first word of every line in an HTML doc by Your Mother
in thread changing format of the first word of every line in an HTML doc by sharkyflip

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.