tye, I agree that your first regex would work, but I was specifically looking to see if I could use a lookbehind with a string anchor such as '^'. Your second regex, however, leaves me confused:
$test =~ s#
(?<! # Negative lookbehind
.{6} # Six of any non-newline character
)
(?<= # Positive lookbehind
[A-Z]{5} # Five caps
)
: # Here's what we're really substituting
#:</B>\n<BR><BR>#;x
In other words, we're going to substitute out a colon, but only if that is preceded by five caps, but only if the five caps in turn are
not preceded by six non-newline characters. Is that what you intended? If so, was that intended as a work-around for the '^' anchor? If it was, I see a lot of problems with it.
Regardless, I'm stuck with my original question: can regex string anchors and lookbehinds be combined?
Cheers,
Ovid
Update: tye, read my commentary in addition to the regex comments and you'll see that we agree. My wording may have been odd, but it's there. :)
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.