I have a regex to replace some SQL criteria with a more user-friendly label on a report.

The SQL where clause is (and, yes, there is a reason for the extraneous parentheses here which I won't bore you with):

AND ((P.NCG_FIS_MGR IN ('H', 'I')))
My regex is:

$sub_name_for_codes =~ s/AND \(\(P.NCG_FIS_MGR IN \('.*'\)\)\) / AND Fiscal Manager Name like $fis_mgr_name_va +lue /g;
This regex is apparently being skipped because no substitions are being made.

The following works fine:

The SQL WHERE clause:
AND P.PROJECT_ID IN ('521590', '529302', '529808', '528230') AND I.NC_ +NAME LIKE 'Thom%'
using this regex:
$sub_name_for_codes =~ s/AND P.PROJECT_ID IN \('.*'\) AND I.NC_NAME LI +KE / AND Investigator like /g;
Any suggestions where I've wandered off the path would be appreciated. Thanks!

Lori

Previous content restored above by GrandFather

I was going to ask a question about why a regex wasn't working and forgot to put the '\' in front of the parentheses to make it escape. Sorry for the inconvenience.

In reply to Regex wild card substitution - SOLVED by Lori713

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.