G'day bayareamonk,

Please use code tags for your data as well as your code.

You say you want to replace ip*internal (which is what I see but I'd guess that's supposed to be ip*[internal] because [internal] would generate that link). However, I don't see either of those forms in what you show as "looks like this", so I'm reduced to making more guesses.

You probably have one or more of these problems in your regex (/\ip*\internal/):

So, overall, my guess is that your substitution should look like this:

s/ip\*\[internal\]/ip-10.10.10.1-internal/

If you provide a clear picture of an input line, what output you expect and what output you're actually getting (along with any error or warning messages), we can probably provide a better answer. More information about what to post and how to post it, such that we can better help you, can be found in the "How do I post a question effectively?" guidelines.

Update: s/left brace/left bracket/ (in 3rd dot point)

-- Ken


In reply to Re: Newbie regular expressions question by kcott
in thread Newbie regular expressions question by bayareamonk

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.