Coder Social home page Coder Social logo

minilibs's Issues

Small example for regex

Hello, can you make a small example for the regex please? I cannot seem to make this work...I am trying this and i expect that i is 1, am I missing something? thanks.

    const char *err = NULL;
    Reprog *rep = regcomp((const char*)"[a-z]13", REG_ICASE, &err);

    Resub sub;
    int x = regexec(rep, "d13", &sub, REG_NOTBOL);

LE: it seems to work with "^[a-z]13". I have read that your regex uses JS flavour, but in JS ommitting the "^" is perfectly fine

No license specified :(

i'm really interested in using your regex library in a piece of software but i can find no license for the sources anywhere in this tree, which means i can't include these sources in my (public domain) trees.

Can you please specify the license conditions for this code (ideally in each header file)?

gcc7 fall-through warning (and fix)

gcc7, in its infinite braindeadedness, warns when a switch's case statement will fall through, and this causes 1 warning in regexp.c:

egexp.c:125:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
   case 0: die("unterminated escape sequence");
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In this case it's trivial to solve by adding:

; return 0

after the call to die(). It won't ever return, so the return is harmless.

That said: the use of die() makes this code ill-suited for use in a library :( - we can't kill the app just because a user inputs an invalid regex:

[stephan@host:~/cvs/minilibs]$ ./test_regexp.exe '\bbl(e+)p\b\' 'foo bar bleep baz bleeeeep'
regcomp: unterminated escape sequence

If you can tell that this code is public domain, MIT, or has a similar non-viral license, i will refactor it for use as a library and contribute the changes back to you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.