RegexUtils does not convert all XSD specifics to Java-compatible regex

Description

Processing of the pattern argument in yangtools fails for some valid XML schema regular expressions as required by RFC 7950.

For example, yangtools failed to process the following pattern:

It appears that yangtools do not recognize the following multi-character escape sequences:

  • \c

  • \C

  • \i

  • \I

And also it does not interpret character class subtraction correctly and pattern matching does not work.

For example, the following pattern should not match 'c' but it does:

 

Proposal solution:

Implement logic in the RegexUtils class to translate XSD patterns into Java-compatible regex. This can be achieved similarly to the method shown in this code:

https://github.com/apache/netbeans/blob/e8fb660e9fe47f14991e46a22ffcb38bf37bab75/ide/schema2beans/src/org/netbeans/modules/schema2beansdev/SchemaRep.java#L1624

Environment

None

Activity

Show:

Peter Šuňa April 12, 2024 at 9:33 AM

Done

Details

Assignee

Reporter

Labels

Components

Fix versions

Priority

Created April 12, 2024 at 8:04 AM
Updated July 15, 2024 at 9:01 AM
Resolved July 15, 2024 at 9:01 AM