N
N
nobster2014-07-11 23:04:48
Perl
nobster, 2014-07-11 23:04:48

How to write a regular expression in perl to remove parentheses in a string?

Help with a regular expression on Perl..
It is necessary to remove everything in brackets (and square ones), including the brackets themselves (square ones too), an example of a string.
The Wall Experience Edition (2011 - Remaster)
Mellon Collie and the Infinite Sadness (2012 - Remaster) [Explicit]
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
yttrium, 2014-07-11
@nobster

$text = "The Wall Experience Edition (2011 - Remaster)\nMellon Collie and the Infinite Sadness (2012 - Remaster) [Explicit]\n";
$text =~ s/[\[\(].*?[\]\)]//g;
print $text;

S
ShamblerR, 2015-02-24
@ShamblerR

bash:
sed 's/[(].*[)]//g'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question