mardi 4 août 2015

How can I match a string with parenthesis in JavaScript?

I want to match a string with its parentheses using Regex.

This is the string I'm trying to match: (CA)

This is my Regex: (/\(([A-Z]{2})\)/)

I've tried using new RegExp("\\(([A-Z]{2})\\)") as well.

No matter what I try I always end up with the Unrecognized expression: (CA) error message in my console.

What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire