in reply to Re: Question about parentheses in regex
in thread Question about parentheses in regex

Oh my god, I love you. Thank you very much. What does the quotemeta do in this case?
  • Comment on Re^2: Question about parentheses in regex

Replies are listed 'Best First'.
Re^3: Question about parentheses in regex
by choroba (Cardinal) on May 27, 2015 at 19:23 UTC
    my $remove = quotemeta "{ (This Word) }"; print $remove; # See what happened.

    You can also shorten it to

    my $text = 'to { (This Word) }'; my $remove = '{ (This Word) }'; $text =~ s/\R//g; $text =~ s/\Q$remove//; # <-- the \Q means quotemeta
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re^3: Question about parentheses in regex
by ww (Archbishop) on May 27, 2015 at 19:41 UTC
    "What does the quotemeta do...?"

    That's thoroughly explained in the docs. Ask your Teddy Bear ... uh, no, I mean, ask your machine's command line interface (using perldoc perlop [look for "Quote and Quote-like Operators"] or ask your browser using a search engine for http://perldoc.perl.org/functions/quotemeta.html which will tell you all about it.

    We value sell-help self-help very highly here in the Monastery. You'll also find interesting (and helpful) information about site's expectations of those asking questions at PerlMonks FAQ section.

    Edited: Typo fixed. TY soonix for catching what I should have.

Re^3: Question about parentheses in regex
by Anonymous Monk on May 28, 2015 at 02:54 UTC