[pcre-dev] [Bug 891] Support [[:<:]] and [[:>:]] patterns

Top Page
Delete this message
Author: Philip Hazel
Date:  
To: pcre-dev
Subject: [pcre-dev] [Bug 891] Support [[:<:]] and [[:>:]] patterns
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=891




--- Comment #8 from Philip Hazel <ph10@???> 2009-09-27 10:47:49 ---
On Sat, 26 Sep 2009, Alan Lehotsky wrote:

> If you tell me a patch to support [[:<:]] isn't likely to be accepted,
> I'll happily abandon any effort to fix it.


It isn't likely to be accepted, to be honest.

> OTOH, if despite its hackiness, if there is a sense of a value to
> having a shorthand notation for the word-contextual equivalent to ^
> and $, then I'd be happy to write and contribute the necessary code.


Well, in Perl regex, \b does the job just fine, IMO. I know it matches
"word boundary" rather than beginning or start of word, but in practice,
that is usually OK because of what comes next. If you want to match the
word "cat", and not get caught by "catch" or "scat" or whatever, the
pattern \bcat\b does what you want. The first \b matches a word
boundary, but the following letter ensures that actually it is the
beginning of a word. And similarly at the end. I'm sure this covers
almost all cases (and if there are any that it doesn't, there is always
a lookahead).

Nevertheless, thanks for the offer to write code. I appreciate such
offers of support. Incidentally, there will be a new release fairly soon
- I am just working on the final things before putting out a candidate -
and there are some changes such that it would be best to wait for the
next release before attempting any patching, should you still be
thinking of that.

Regards,
Philip


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email