Giter Site home page Giter Site logo

regex3000's People

Contributors

marcbllv avatar

Stargazers

 avatar

Watchers

 avatar  avatar

regex3000's Issues

Use slice of runes instead of string

Context

It's complex to extract runes one-by-one from a string, better convert the input regex to a slice of rune at first.

Scope and solution

Replace string usage by []rune everywhere

Handle regex with bad format properly

Context

Currently regexes with a bad format usually raise a segfault.
This must be avoided and errors should be handled in a clean way.

Scope and solution

TBD

Bug when using brackets

Bug

When runnning:

$ bin/regex3000 'I have [1-9]+ l?eg{1,2}s' 'I have 3 legs'

it outputs false, expected true.

Scope and solution

There's an issue with the brackets, we need to plug the previous states (here previous states of letter g) to the final ones.

Return matching position in string instead of cropping string

Context

Matching function currently return true/false + the rest of string that matches

It would be cleaner to return the match position (if match==true), and this would allow for further developments in an easier way (eg: matching the beginning / end of string)

Scope and solution

All Match() function in inspectors should take as input:

  • a list of integer position where matching is working
  • the full string to match

And return:

  • return a list of matching position (incremented)

Handle negative sets

Context

We cannot use "negative" sets using brackets and ^, eg: `[^a-zA-Z].

Scope and solution

Update brackets parsing function: if first char is ^, then create an OppositeSetInspector instead of a SetInspector

Better parser for braces

Context

The braces parsing is complex and not very clean to write.

Scope and solution

  • Write generic parsers for ranges (braces content), string and integers
  • Write a function to combine parsers
  • Put this alltogether

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.