Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yang regular char \w not include underline char #357

Closed
nowaits opened this issue Aug 24, 2022 · 2 comments
Closed

yang regular char \w not include underline char #357

nowaits opened this issue Aug 24, 2022 · 2 comments

Comments

@nowaits
Copy link
Contributor

nowaits commented Aug 24, 2022

Hi olof:
Yang regular char \w not include underline char. The transform of \w from XSD regex to posix ERE in regexp_xsd2posix maybe wrong. \w was translate to [^[:punct:][:space:][:cntrl:]], but char _ was excluded.

\w should be [[:alnum:]|_] and \W should be [^[[:alnum:]|_]], here is the diff:

diff --git a/lib/src/clixon_regex.c b/lib/src/clixon_regex.c
index 0c47dabc..9e25d56b 100644
--- a/lib/src/clixon_regex.c
+++ b/lib/src/clixon_regex.c
@@ -181,10 +181,10 @@ regexp_xsd2posix(char  *xsd,
                break;
            case 'w': /* word */
                //cprintf(cb, "[0-9a-zA-Z_\\\\-]")
-               cprintf(cb, "[^[:punct:][:space:][:cntrl:]]"); 
+               cprintf(cb, "[[:alnum:]|_]"); 
                break;
            case 'W': /* inverse of \w */
-               cprintf(cb, "[[:punct:][:space:][:cntrl:]]"); 
+               cprintf(cb, "[^[[:alnum:]|_]]"); 
                break;
            default:
                cprintf(cb, "\\%c", x);
@nowaits
Copy link
Contributor Author

nowaits commented Aug 25, 2022

Here is my pull request:
#358

@olofhagsand
Copy link
Member

I pulled the PR, thanks!
Does this fix the issue? If sp, please verify and close this issue.

@nowaits nowaits closed this as completed Sep 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants