Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Answer: How do I write a regex which allows meta-quoting?

by WHolcomb (Initiate)
on Apr 13, 2000 at 19:39 UTC ( #7472=categorized answer: print w/replies, xml ) Need Help??

Q&A > regular expressions > How do I write a regex which allows meta-quoting? - Answer contributed by WHolcomb

Quite nearly there. All that is left is that things in brackets like array subscripts are made into links to other nodes. That ought to be fixable by replacing them with the html codes, which I don't know off the top of my head. Ahh, they are [ -> [ and ] -> ]

To the monks who maintain this monestary I might suggest that they have the node linking ignore []'s inside <pre>'s.


$c = "\#";
$m = "\\";

while(<IN>) {
  split /\Q$c\E/;
  $_ = $_[0];
  next if(/\A\s*\Z/);
  $string = $_;
  for($i = 1; $i <= $#_; $i++) {
   $_ = $_[$i - 1];
   if("$1" eq "$m") {
     $string .= "$c" . $_[$i];
   } else {

  • Comment on Answer: How do I write a regex which allows meta-quoting?
Log In?

What's my password?
Create A New User
[Sinistral]: stonecolddevin / stevieb - would 'he' in this context (looked at last 50 lines and didn't see discussion) be a certain solar timepiece user?
[stonecolddevin]: Sinistral yes indeed
[Discipulus]: he does not learn, nor teach, nor learn
[planetscape]: hello all
[stonecolddevin]: o/ planetscape
[Sinistral]: I think that just the sight of his username now causes a downvote storm. I agree, and the gratuitous use of formatting does make reading hard. I've given him +1 on things where there seemed to be actual good advice, but I think the big
[Sinistral]: nail in coffin was the rant against a Schwarzian Transform
[stonecolddevin]: at best, from what i've seen, his knowledge is accurate up to maybe 2002. the sheer volume of words is mostly worthy of a downvote in most cases though i think
[erix]: ITYM Schwartzian Transform :P
[erix]: hey planetscape :)

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2017-06-22 20:54 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (530 votes). Check out past polls.