[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Word Boundary problem with regex
From: |
Pascal Bourguignon |
Subject: |
Re: Word Boundary problem with regex |
Date: |
Mon, 06 Jun 2005 00:55:10 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
Tim Johnson <tim@johnsons-web.com> writes:
> In case of word wrapping the text between (but not including) the lines
> of asterisks should be on one line:
>
> I am using the following expression
> *******************************************************************************
> \\([^][ \t\r\n{}()]+\\):[
> ]*\\(d\\(ef\\|oes\\)\\|func\\(tion\\)\\|has\\|sub?\\)
> *******************************************************************************
>
> To colorize the following words: "def" "does" "func" "function" "has"
> "sub" - which define subroutines.
>
> When I type the following: test: def[val][print val], "def" is
> colorized properly. One would exect that adding a letter to "def" would
> turn off the target color, but does not. This suggests to me that
> I have not properly defined the word boundary in the expression above.
>
> Can anyone tell me what I am doing wrong?
>
> FYI: This is for the rebol programming language (www.rebol.com), it
> should be noted that in lispish fashion, a subroutine is an
> expression, not an immutable control structure.
Just add "\\>" at the end.
You don't need "\\<" at the beginning since you're matching spaces and
special characters.
--
__Pascal Bourguignon__ http://www.informatimago.com/
Until real software engineering is developed, the next best practice
is to develop with a dynamic system that has extreme late binding in
all aspects. The first system to really do this in an important way
is Lisp. -- Alan Kay