[pcre-dev] matching at a word boundary

Página superior
Eliminar este mensaje
Autor: David Byron
Fecha:  
A: pcre-dev
Asunto: [pcre-dev] matching at a word boundary
I've got a pattern and a string that I figure should match that pattern, but
pcre doesn't think it matches.

The pattern in question is "\b\[0-9\b"

Which in English is supposed to mean find a literal [0-9 as its own word.

I'm using pcrecpp like this:

pcrecpp::RE_Options options;
options.set_utf8(true).set_caseless(true);
pcrecpp::RE regex(word_regex,options);
ASSERT(regex.error().length() == 0);
if (regex.PartialMatch(value))
...

When value is "[0-9 on its own", PartialMatch returns 0, but I expect it to
match. When I use the pattern "\[0-9\b" (i.e. no leading \b) I get a match.
Is my pattern wrong? I could use a hand.

The output of pcre_version is:

7.9 2009-04-11

I'm running on XP, compiling with MSVC 2005.

Thanks much for your help.

-DB