Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

( #7472=categorized answer: print w/ replies, xml ) Need Help??

Q&A > regular expressions > How do I write a regex which allows meta-quoting? 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.
s/(^[(?:([^\\|\A)\\(\\{2})*\#)]*)(.*)/$1/

(?<!)

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

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

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

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2014-07-26 06:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls