[YANGTOOLS-484] Unable to compile pattern defined in module when using Unicode blocks Created: 03/Aug/15  Updated: 10/Apr/22  Resolved: 18/Dec/15

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Martin Ciglan Assignee: Igor Foltin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 4079

 Description   

Given Yang snippet:

type string {
pattern "(\p

{IsBasicLatin}|\p{IsLatin-1Supplement})*";
}

evokes:

[WARNING] Unable to compile pattern defined in module <name> at line <line>. Error message: Unknown character script name {BasicLatin} near index <column>
^(\p{IsBasicLatin}

|\p

{IsLatin-1Supplement}

)*$

Poblem comes from the fact that in the XML Schema specification,
Unicode character blocks are matched by "\p

{Is...}

" [1],
whereas Java expects "\p

{In...}

" [2].

[1] http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#nt-IsBlock
[2] http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html

This needs to be fixed.

For time being, these are two possible workarounds:

1)
type string {
pattern "(\p

{InBasicLatin}

|\p

{InLatin-1Supplement}

)*
}

2)
type string {
pattern "([\x00-\x7F]|[\x80-\xFF])*
}



 Comments   
Comment by Igor Foltin [ 27/Aug/15 ]

Fix pushed:

https://git.opendaylight.org/gerrit/#/c/26080/

Generated at Wed Feb 07 20:53:23 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.