Why does my Perl regex complain about "Unmatched ) in regex"?

Posted by NJTechGuy on Stack Overflow See other posts from Stack Overflow or by NJTechGuy
Published on 2010-03-16T22:02:23Z Indexed on 2010/03/16 23:41 UTC
Read the original article Hit count: 308

Filed under:
|
if($title =~ s/(\s|^|,|\/|;|\|)$replace(\s|$|,|\/|;|\|)//ig)

$title can be a set of titles ranging from President, MD, COO, CEO,...

$replace can be (shareholder), (Owner) or the like.

I keep getting this error. I have checked for improperly balanced '(', ')', no dice :(

Unmatched ) in regex; marked by <-- HERE in m/(\s|^|,|/|;|\|)Owner) <-- HERE (\s|$|,|/|;|\|)/

If you could tell me what the regex does, that would be awesome. Does it strip those symbols? Thanks guys!

© Stack Overflow or respective owner

Related posts about regex

Related posts about perl