Doesn't the regex substitution pattern have two parts...the part to be look for and the part to use for the replacement?

I like your solution, but I'm confused by the use of braces (i.e., { and }) for the first part and then it appears you're using the slash, /, for the second part.

Did you mean:

s{(\Qhttp://v2vi.click4assistance.co.uk/c4a.aspx?AccNo=Inter12109&IDENT=\E)US}${1}US}/g

If so, then how can you use the braces to separate the part of the substitution and also for the numeric placeholder? It seems like it should be something like this:

s|(\Qhttp://v3vi.click4assistance.co.uk/c4a.aspx?AccNo=Inter12109& +IDENT=\E)US|${1}UK|g;

so that the regex separators are distinct from the characters (like the braces) and don't get confused with the separators.

But you're a lot more experienced than I, so I'm sure I'm missing something...something that's probably obvious. As I noted, I really like your regex...even though I don't entirely understand it...so I'm anxious to learn more.

Thanks, JavaFan, I always learn from eveyone here.

ack Albuquerque, NM

In reply to Re^2: regex issue by ack
in thread regex issue by rahulgsp83

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.