[YANGTOOLS-658] Escape Meta-characters like $, ^ in Regular Expression provided in pattern statement Created: 05/Sep/16  Updated: 10/Apr/22  Resolved: 12/Jan/17

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

Type: Bug
Reporter: Kaja Mohideen Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Issue Links:
Blocks
is blocked by YANGTOOLS-587 Parser: XSD regular expressions are i... Resolved
Duplicate
duplicates YANGTOOLS-587 Parser: XSD regular expressions are i... Resolved
External issue ID: 6630

 Description   

Pattern statement (RFC 6020, Section 9.4.6) accepts regular expression defined by XSD Schema Spec (https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#regexs) which doesn't have meta-characters like ^ and $.

XSD Schema definition of RegExp expects to match the entire string and so Yangtools is correctly returning the pattern defined in Yang enclosed within ^ and $. But, it doesn't escape these characters if they are found inside the pattern value.

Due to this issue, attempts to use PatternConstraint::getRegularExpression as is with Java Pattern/Matcher classes doesn't work as expected.



 Comments   
Comment by Kaja Mohideen [ 05/Sep/16 ]

Issue uncovered while trying to use YT to parse the iana-crypt-hash yang module (https://tools.ietf.org/html/rfc7317#section-5)

Comment by Peter Kajsa [ 06/Sep/16 ]

It seems that solution of Bug-5410 should resolve also this issue.

Comment by Kaja Mohideen [ 12/Jan/17 ]

1. I couldn't find the relevant code change that could have solved this issue.
2. Apparently, the issue is not fixed. I had a work-around in my code for this issue. Even after upgrade to boron, removing the wor-around is causing the original issue.
3. Moving back to Confirmed.

Comment by Igor Foltin [ 12/Jan/17 ]

This issue is addressed in the following bug - https://bugs.opendaylight.org/show_bug.cgi?id=5410

However, the bug has not been resolved yet and it is planned for Carbon M5.

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