I would like to write a regular expression to match two parentheses (
between $'s (not necessarily consecutive).
For example$c(ad(b*$
, $a((*b$
and $$*(a(b(*$$
are match but $a($
and $(a)$
are not.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityI would like to write a regular expression to match two parentheses (
between $'s (not necessarily consecutive).
For example$c(ad(b*$
, $a((*b$
and $$*(a(b(*$$
are match but $a($
and $(a)$
are not.
A dollar sign [$]
, followed possibly by some chars that are neither a dollar sign nor a left paren [^$(]*
, followed by a left paren [(]
, followed (again) possibly by some chars that are neither a dollar sign nor a left paren [^$(]*
, followed by a dollar sign [$]
.
"[$][^$(]*[(][^$(]*[(].*[$]"
(
is not special or to know how to escape special chars such as $
. (And yes, if it were for my own code, I would write what you wrote.)
– Drew
Jun 4 '15 at 21:42