in reply to RE: Re: regex question
in thread regex question

$pre= "\\*\\*";

You can save some eyesight by using single quotes: $pre='\*\*'

I also came up with: my @parts = split(/($pre{2,}.*?$post{2,})/,$text); Where $pre and $post are defined as a single character.

Replies are listed 'Best First'.
RE: RE: RE: Re: regex question
by Fastolfe (Vicar) on Oct 18, 2000 at 23:49 UTC
    In addition, if $pre and $post (the two-character versions) might be changed some day, perhaps by someone that doesn't recognize/appreciate the fact that they'll be used in a regular expression and thus might not quote them, we can use the \Q and \E codes to avoid the problem altogether:
    $pre = '**'; $post = '%%'; /(\Q$pre\E.*?\Q$first\E*\Q$post\E)/