[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Word Boundary problem with regex
From: |
Tim Johnson |
Subject: |
Re: Word Boundary problem with regex |
Date: |
Mon, 6 Jun 2005 08:56:48 -0800 |
User-agent: |
Mutt/1.4.2.1i |
* Tim X <timx@spamto.devnul.com> [050606 01:22]:
>
> I'm not entirely clear on exactly what it is your trying to match, but
> would recommend having a look at regexp-opt as it is particularly
> useful for defining regexp for font-locking. A reasonably clear
> example of its use can be found in sql.el - the sql-mode which comes
> bundled with emacs.
>
> HTH
>
> Tim
>
> ,----[ C-h f regexp-opt RET ]
> | regexp-opt is a compiled Lisp function in `regexp-opt'.
> | (regexp-opt STRINGS &optional PAREN)
> |
> | Return a regexp to match a string in STRINGS.
> | Each string should be unique in STRINGS and should not contain any regexps,
> | quoted or not. If optional PAREN is non-nil, ensure that the returned
> regexp
> | is enclosed by at least one regexp grouping construct.
> | The returned regexp is typically more efficient than the equivalent regexp:
> |
> | (let ((open (if PAREN "\\(" "")) (close (if PAREN "\\)" "")))
> | (concat open (mapconcat 'regexp-quote STRINGS "\\|") close))
> |
> | If PAREN is `words', then the resulting regexp is additionally surrounded
> | by \< and \>.
> `----
Thanks Tim (see the reply to this thread from Pascal)
Your tip on using regexp-opt will be very helpful for
this regex noob.
cheers
tim
--
Tim Johnson <tim@johnsons-web.com>
http://www.alaska-internet-solutions.com