Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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 making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-05-23 12:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (467 votes), past polls