From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "D. D. Brierton" Newsgroups: gmane.emacs.help Subject: Help needed with regexps Date: Fri, 13 Feb 2004 19:17:44 +0000 Organization: DZR Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1076700839 18674 80.91.224.253 (13 Feb 2004 19:33:59 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 13 Feb 2004 19:33:59 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Feb 13 20:33:47 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Arj4N-0002yI-00 for ; Fri, 13 Feb 2004 20:33:47 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1Arj1q-0004W5-Na for geh-help-gnu-emacs@m.gmane.org; Fri, 13 Feb 2004 14:31:10 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!landlord!wards.force9.net.POSTED!not-for-mail User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Original-Newsgroups: gnu.emacs.help Original-Lines: 93 Original-NNTP-Posting-Host: 212.159.101.92 Original-X-Complaints-To: abuse@plus.net.uk Original-X-Trace: wards.force9.net 1076700024 212.159.101.92 (Fri, 13 Feb 2004 19:20:24 GMT) Original-NNTP-Posting-Date: Fri, 13 Feb 2004 19:20:24 GMT Original-Xref: shelby.stanford.edu gnu.emacs.help:120878 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:16828 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:16828 Hi, Could a regexp guru look over these regexps and tell me if they're correct and if they could be improved/simplified? I'm tweaking my multiple-major-mode setup of psgml / php-mode / css-mode / javascript-generic-mode for (X)HTML editing. My previous regexps worked only 75% of the time, and I was trying to improve them and have ended up breaking things altogether. The current attempt seems to send emacs into some kind of loop -- CPU hits 100% and I have to kill emacs: ; Set up an mmm group for fancy html editing (mmm-add-group 'fancy-html '( (html-php-embedded :submode php-mode :face mmm-code-submode-face :front "<[?]php" :back "[?]>") (html-css-embedded :submode css-mode :face mmm-code-submode-face :front "" :back "") (html-css-attribute :submode css-mode :face mmm-code-submode-face :front "\\bstyle=\"?" :back "\"") (html-javascript-embedded :submode javascript-generic-mode :face mmm-code-submode-face :front "" :back "") (html-javascript-attribute :submode javascript-generic-mode :face mmm-code-submode-face :front "\\bon\\w+=\"?" :back "\"") ) ) I have to edit a lot of other people's HTML, and it is very often invalid. Element and attribute names may be in a mix of upper and lower case, atrribute values may or may not be quoted, required attributes may be omitted and nonexistent attributes included! In particular, the regexps for html-css-embedded and html-javascript-embedded are the ones I need someone to look over for me. So, for CSS "" should match a "style" element regardless of how its spaced out which at least contains the string "css" somewhere (and "style" and "css" may be upper or lower case). For example,