Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unescaped left brace regex error

I’m not an expert in regex and can't figure what I am supposed to change here.

I get these two errors

Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/^(.*?)(\\)?\${ <-- HERE ([^{}]+)}(.*)$/ at /usr/share/perl5/Debconf/Question.pm line 72.

Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^}]+)}/ at /usr/share/perl5/Debconf/Config.pm line 30.

When I jump to the line 72 this is what I see

while ($rest =~ m/^(.*?)(\\)?\${([^{}]+)}(.*)$/sg) {
like image 369
TheCabDriverCheatedMeToday Avatar asked Apr 02 '17 07:04

TheCabDriverCheatedMeToday


1 Answers

It's a deprecation warning indicating the code will stop working in the future.

If you want to match a { literally, you should escape it.

In other words, you can fix the issue (silencing the warning) by replacing the first { with \{.

like image 97
ikegami Avatar answered Sep 19 '22 15:09

ikegami