[pcre-dev] pcre syntax question

Pàgina inicial
Delete this message
Autor: David Mathog
Data:  
A: pcre-dev
Assumpte: [pcre-dev] pcre syntax question
Hi,

Is this a bug or is there some facet to the syntax which explains it?
These work as expected:

# ./pcredemo 'sense' 'sense and sensibility'
Match succeeded
0: sense

# ./pcredemo '(sense)' 'sense and sensibility'
Match succeeded
0: sense
1: sense

# ./pcredemo '((sense))' 'sense and sensibility'
Match succeeded
0: sense
1: sense
2: sense

as does this (from man pcrepattern):

# ./pcredemo '(sens|respons)e and \1ibility' 'sense and sensibility'
Match succeeded
0: sense and sensibility
1: sens

but...

# ./pcredemo '((sens|respons)e and \1ibility)' 'sense and sensibility'
No match

Based on the earlier examples, I was expecting to see
0: sense and sensibility
1: sense and sensibility
2: sens

Why does the extra () around the whole expression break it?

This is PCRE 7.6-2.1.

Thanks,

David Mathog
mathog@???
Manager, Sequence Analysis Facility, Biology Division, Caltech