Some emacs code to start with:
(defun perlish-fix-regexps (regexp)
"Simple translation of a perlish REGEXP to an emacs one."
(let ( (new-pattern regexp) )
(setq new-pattern (replace-regexp-in-string "(" "\\\\(" new-patter
+n))
(setq new-pattern (replace-regexp-in-string ")" "\\\\)" new-patter
+n))
(setq new-pattern (replace-regexp-in-string "|" "\\\\|" new-patter
+n))
(setq new-pattern (replace-regexp-in-string "\\\\\"" "\"" new-patt
+ern))
new-pattern))
(perlish-fix-regexps "(.*?)")
(perlish-fix-regexps "(ha|ho)")
(perlish-fix-regexps "\"[ \t]*(.*?)[ \t]*\"")
(defun perlish-match (string pattern)
"Apply the perlish PATTERN to STRING, returns capture from first gro
+up of parens."
(let (
(emacs-pattern (perlish-fix-regexps pattern))
(found "")
)
(if (string-match emacs-pattern string)
(setq found (match-string 1 string))
)
))
(perlish-match "ha, ha, ho, ho!" "(ha|ho)" )
(perlish-match
" \" quote \" "
"\"[ \t]*(.*?)[ \t]*\"")