That was what i thought when look into the patternMatch source code.
I will try using RegularExpression.
It weird to call patternMatch method like that :)
Thanks for your help !
Alberto Massari wrote:
>
> Hi Thomy,
> it tuns out that XMLString::patternMatch is not a pattern-matching
> method, but more a "find string" API. In order to do what you need you
> must use the RegEx class, like in
>
> RegularExpression p("PAG_[0-9]{1,}");
> bool bMatch=p.matches("PAG_1");
>
> Alberto
>
> Thomy wrote:
>> Hi Alberto,
>>
>> I use the last version in the download area, i guess it's the 3.0.1
>> available here : http://xerces.apache.org/xerces-c/install-3.html#Unix
>> Maybe i misunterstood the use of patterMatch method, i checked the source
>> code and it doesn't seem to use regexp ...
>> Is there something to do with regExp before using them like a pattern,
>> like
>> a compile method like in java ?
>>
>> thanks for your answer and your help !
>>
>>
>> Alberto Massari wrote:
>>
>>> Hi Thomy,
>>> I tested your regex with the current trunk of Xerces 3.0, and it works;
>>> which version are you using?
>>>
>>> Alberto
>>>
>>> Thomy wrote:
>>>
>>>> Hi !
>>>>
>>>> I'm trying to use XMLString::patternMatch to check syntax of XMLString
>>>> gived
>>>> by a user.
>>>>
>>>> i made a pattern to recognize an id : PAG_[0-9]{1,}
>>>> My test id is PAG_1
>>>> i call patternMatch with an XMLString containing "PAG_1" and check with
>>>> this
>>>> pattern :
>>>> const XMLCh AltoXMLConst::validPage[] =
>>>> {
>>>> chLatin_P,chLatin_A,chLatin_G,chUnderscore, chOpenSquare, chDigit_0,
>>>> chDash, chDigit_9, chCloseSquare, chOpenCurly, chDigit_1, chComma,
>>>> chCloseCurly, chNull
>>>> };
>>>>
>>>> it's return -1. I guess i have a syntax problem because if i made a
>>>> pattern
>>>> which is "PAG_" it's return 0.
>>>> Is there a problem with my syntax of "any number from 1 to infinite",
>>>> how
>>>> to
>>>> write it well ?
>>>>
>>>> Thx in advance for your help
>>>>
>>>>
>>>
>>>
>>
>>
>
>
>
--
View this message in context:
http://www.nabble.com/patternMatch-and-regular-expression-syntax-tp25239749p25257747.html
Sent from the Xerces - C - Users mailing list archive at Nabble.com.