You might try to trim the boundary assertions off of the stringized Regexp object (sorry for all the wrap-around):

c:\@Work\Perl\monks>perl -wMstrict -le "use Regexp::Common; ;; print qq{$RE{profanity}}; print qq{A: match '$1'} if 'xxxpissxxx' =~ m{ ($RE{profanity}) }xms; ;; print '--------'; (my $erp = $RE{profanity}) =~ s{ \A \Q(?:\b\E (.*) \Q\b)\E \z }{$1}xm +s; print qq{'$erp'}; ;; print qq{B: match '$1'} if 'xxxpissxxx' =~ m{ ($erp) }xms; " (?:\b(?:(?:piss(?:\ take|\-take|take|e(?:rs|[srd])|ing|y)?|quims?|shit +(?:t(?:e(?:rs|[dr])|ing|y)|e(? :rs|[sdry])|ing|[se])?|t(?:urds?|wats?)|wank(?:e(?:rs|[rd])|ing|s)?|a( +?:rs(?:e(?:\ hole|\-hole|hole| [sd])|ing|e)|ss(?:\ holes?|\-holes?|ed|holes?|ing))|b(?:ull(?:\ shit(? +:t(?:e(?:rs|[dr])|ing)|s)?|\-s hit(?:t(?:e(?:rs|[dr])|ing)|s)?|shit(?:t(?:e(?:rs|[dr])|ing)|s)?)|low( +?:\ jobs?|\-jobs?|jobs?))|c(?: ock(?:\ suck(?:ers?|ing)|\-suck(?:ers?|ing)|suck(?:ers?|ing))|rap(?:p( +?:e(?:rs|[rd])|ing|y)|s)?|u(?: nts?|m(?:ing|ming|s)))|dick(?:\ head|\-head|ed|head|ing|less|s)|f(?:uc +k(?:ed|ing|s)?|art(?:e[rd]|ing |[sy])?|eltch(?:e(?:rs|[rsd])|ing)?)|ha(?:rd[\-\ ]?on|lf(?:\ a[sr]|\-a +[sr]|a[sr])sed)|m(?:other(?:\ fuck(?:ers?|ing)|\-fuck(?:ers?|ing)|fuck(?:ers?|ing))|uth(?:a(?:\ fuck +(?:ers?|ing|[aaa])|\-fuck(?:er s?|ing|[aaa])|fuck(?:ers?|ing|[aaa]))|er(?:\ fuck(?:ers?|ing)|\-fuck(? +:ers?|ing)|fuck(?:ers?|ing)))| erde?)))\b) -------- '(?:(?:piss(?:\ take|\-take|take|e(?:rs|[srd])|ing|y)?|quims?|shit(?:t +(?:e(?:rs|[dr])|ing|y)|e(?:rs| [sdry])|ing|[se])?|t(?:urds?|wats?)|wank(?:e(?:rs|[rd])|ing|s)?|a(?:rs +(?:e(?:\ hole|\-hole|hole|[sd] )|ing|e)|ss(?:\ holes?|\-holes?|ed|holes?|ing))|b(?:ull(?:\ shit(?:t(? +:e(?:rs|[dr])|ing)|s)?|\-shit( ?:t(?:e(?:rs|[dr])|ing)|s)?|shit(?:t(?:e(?:rs|[dr])|ing)|s)?)|low(?:\ +jobs?|\-jobs?|jobs?))|c(?:ock( ?:\ suck(?:ers?|ing)|\-suck(?:ers?|ing)|suck(?:ers?|ing))|rap(?:p(?:e( +?:rs|[rd])|ing|y)|s)?|u(?:nts? |m(?:ing|ming|s)))|dick(?:\ head|\-head|ed|head|ing|less|s)|f(?:uck(?: +ed|ing|s)?|art(?:e[rd]|ing|[sy ])?|eltch(?:e(?:rs|[rsd])|ing)?)|ha(?:rd[\-\ ]?on|lf(?:\ a[sr]|\-a[sr] +|a[sr])sed)|m(?:other(?:\ fuck (?:ers?|ing)|\-fuck(?:ers?|ing)|fuck(?:ers?|ing))|uth(?:a(?:\ fuck(?:e +rs?|ing|[aaa])|\-fuck(?:ers?|i ng|[aaa])|fuck(?:ers?|ing|[aaa]))|er(?:\ fuck(?:ers?|ing)|\-fuck(?:ers +?|ing)|fuck(?:ers?|ing)))|erde ?)))' B: match 'piss'

Update: Of course, this gets you right back to the Scunthorpe Problem noted above by Paladin!


Give a man a fish:  <%-{-{-{-<


In reply to Re: Please help with Regexp::Common by AnomalousMonk
in thread Please help with Regexp::Common by scorpio17

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.