Hi Monks

I have a variable which contains perl coding.

$a=' $text=~s#Find \#Text#Replace Text#; $text=~s/Find \/Text/Replace Text/; $text=~s{Find \}Text}{Replace Text}; ';
I need to get find patter and replace patter into variabls from $text variable.
if ($a=~m#$text=~s(.)\s*(?<!\1)#) { # need value $findtext='Find \#Text'; # need value $repltext='Replace Text'; }

when I ran this, It will showing an error message.

Variable length lookbehind not implemented in regex; marked by <-- HER +E in m/=~\s*s(.)(?<!\1) <-- HERE / at script.pl line 8 (#1) (F) Lookbehind is allowed only for subexpressions whose length is +fixed and known at compile time. The <-- HERE shows in the regular expressio +n about where the problem was discovered. See perlre. Uncaught exception from user code: Variable length lookbehind not implemented in regex; marked by + <-- HERE in m/=~\s*s(.)(?<!\1) <-- HERE / at script.pl line 8.

Please guide me how can i do this.

Thanks
Kanishk


In reply to Regexp help!! by kanish

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.