A bit broader than you specified - this replaces any single letter and optional parenthetical value.

$_= "c*theta*h^(1+psi)=(1-alpha)*y;\n1 = beta*(c/c(+1)*alpha*y(+1)/k+( +1-delta));\ny = a*(k(-1)^alpha)*(h^(1-alpha));\nk = y-c+(1-delta)*k(- +1);\nln(a) = rho*ln(a(-1))+ e;\n"; s/(?<!\pL)(\pL)(\([\d+-]+\))?(?!\pL)/(${1}SS*exp($1$2))/g; print; #prints (cSS*exp(c))*theta*(hSS*exp(h))^(1+psi)=(1-alpha)*(ySS*exp(y)); 1 = beta*((cSS*exp(c))/(cSS*exp(c(+1)))*alpha*(ySS*exp(y(+1)))/(kSS*ex +p(k))+(1-delta)); (ySS*exp(y)) = (aSS*exp(a))*((kSS*exp(k(-1)))^alpha)*((hSS*exp(h))^(1- +alpha)); (kSS*exp(k)) = (ySS*exp(y))-(cSS*exp(c))+(1-delta)*(kSS*exp(k(-1))); ln((aSS*exp(a))) = rho*ln((aSS*exp(a(-1))))+ (eSS*exp(e));

In reply to Re: Help with regex - find captured pattern twice by hbm
in thread Help with regex - find captured pattern twice by pachydermic

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.