Code Monkey home page Code Monkey logo

srl-php's People

Contributors

bartoszkolanko avatar dennis14e avatar karimgeiger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

srl-php's Issues

Rename "number" to "digit"

The word number implies a sequence of one or more digits (perhaps with an optional hyphen at the start) while it actually represents a single digit in SRL (see the port capture group in the URL valdiation section here), so "number" should be renamed to "digit" as this is exactly what it represents. Perhaps "number" could then be implemented as an acutal sequence of multiple digits.

No word boundary anchors in SRL

I'm giving a talk on regular expressions at the PyOhio Conference this year. A lot of the talk will be in a Juypter Notebook using the Python implementation of SRL. I'm going over the documentation on the web site and only see provisions begin/end (of string) anchors. Is there none for begin/end of words, Words?

Tom Fetherston

Can't do this ((data-id)="|src=") ?

I am wrong or i can't do this regex : ((data-id)="|src=")
I tried lots of thing, my last attempt is this one :

capture ( any of ( ( capture(literally 'data-id'), literally '="' ), (literally 'src="') ) )

The SRL Query contains an error: Non-matching parenthesis found.

About the GPL3 license

Any chance to change the license to something that we could use in proprietary software?

Webapp to test SRLs versus inputs

Something like this: http://www.phpliveregex.com/ but for SRL would be very useful to test on the fly.

Also a suggested feature would be to generate links that include the SRL base64 encoded in the URL so they can be thrown in comments in the code if we just used the generated regex, to refer back to the SRL and edit it.

This idea came to me when I read this bit in the README

But if you like, you can build the expression somewhere else and just use the result in your app. If you do that, please keep the code for that query somewhere and link to it, otherwise the Regular Expression will be unreadable just as before.

Generate the SRL for a regular expression

This would be a killer feature for this project - being able to take existing regex and output a pretty printed SRL expression for it. That would allow verification and and modification of existing regexes much, much easier.

Implementation of SRL in C# (.NET)

I'm .NET developer, I found this amazing repo and I would like to see a C# implementation of SRL.. Do you know if there is someone working on this? What do I need to help?

Problems with usage of `uppercase letter`

The query

begin with (digit once),
any of (letter, digit, uppercase letter) once or more,
must end

fails to compile, with the error

The SRL Query contains an error: Invalid parameter given for digit.

But the same query, if rewritten as

begin with (digit once),
any of (uppercase letter, letter, digit) once or more,
must end

...seems to compile correctly, and matches my test string 1ABCdef. From the error message, I guess uppercase is being passed as a parameter to digit in the first example?

Language File

Hi Karim,
I think you should translation files on your project. I want your query translate to turkish.

Implementation of SRL in C++ (and C)

Hi all,

I get interested in SRL and I am trying to build a C++ library for "compiling" SRL into regex string, and the library is about to be finished.

And I think no one else has plan to do so (yet?). So if you think it's a good idea, maybe you could create a repo SimpleRegex/SRL-CPP and grant me the privilege to edit it so that I could directly work on it.

Thank you!

PHP 8 500 unexpected token "match"

Hi there,

Since PHP 8.0 "Match" is a reserved PHP keyword, which throws a 500 when loading the class "Match" from SRL.
This breaks the package on any PHP 8.0+ versions

Generate verbose syntax from regexp

It would be great to have inverse behavior.

User provides:

/^([A-Z0-9._%+-])+@[A-Z0-9.-]+\.[A-Z]{2,}$/i

Output:

begin with any of (digit, letter, one of "._%+-") once or more,
literally "@",
any of (digit, letter, one of ".-") once or more,
literally ".",
letter at least 2,
must end, case insensitive

Code error on getting started page

From this page: https://simple-regex.com/welcome. PHP and Composer sample code:

$srl = new SRL('literally "color: ", capture (letter once or more) as "color", literally "."');

$matches = $regEx->getMatches('Favorite color: green. Another color: yellow.');

echo $matches[0]->get('color'); // green
echo $matches[1]->get('color'); // yellow

SRL instance variable is defined as $srl but is used as $regEx.

"Either" really means "Any"

In English, "either" means a choice between two ("Choose either A or B). For three or more, the word is "any" (Choose any of these: A, B, C, or D). The "either" keyword is jarring and confusing.

How about changing "Either" to "Any", because that seems to be the syntax--"any of the following".

Negated character classes

Is there a way to represent negated character classes? e.g. [a-z]{2}[^0-9]? Neither of these seem to work:

letter exactly 2 times,
not digit
letter exactly 2 times,
no digit

...incidentally, both of these generate the regular expression [a-z]{2}[0-9] โ€“ I'm not sure if this is a bug, or just an expected consequence of an unrecognized keyword.

Using "basename" as capture group name generates wrong RegEx

SRL Query:

capture (anything) as "basename"

Expected Regular Expression:

/(?<basename>.)/

Actual Regular Expression:

/(?<basename>.)(?:(?:basename))/

Description:

Every other name besides "basename" generates the desired result. When supplying "basename" (case insensitive) as capture name, an additional literally-check will be added.

Another approach in regex.

Hi,

I like your language for regex, nice work.
But still, looking #at code of regex you can not say what it for.
I have another idea and approach for regex: splitting.

username@domain.com
where
  username = [A-Z0-9._%+-]+
  domain = ([0-9]|[a-z]|[\.-])+
  com = [a-z]{2,}
insensitive

Another example:

protocol://domain:port/path?parameters
where 
  protocol = [a-z]+
  domain = [a-z]+(?:[a-z]|(?:\.))+[a-z]{2,}
  port = [0-9]+
  path = ((?:\/).*?)part(?:\?)? where
    part = (?:(?:\?)|$)
  parameters = .*?
insensitive

What do you think?

ANTLR version ?

Hi
I like the project but have not had the possibility to use it yet in my work projects but I am coming up to one project that will have heavy use of it. I like regular expressions and to use them but I usually need to consider other developers

I am thinking of rewriting it in ANTLR 4 to have the generation being done from common rules and use the tests on the languages in the ANTLR languages to make it easier to maintain. I see that as needed as I can see that it is long time since maintenance have been done on the repositories in any form or way.

For C# support I afterwards want to make a T4 template where I can increase the developer experience even further

Syntax synomyms

Already suggested from Reddit:

exactly as synonym to literally

either as synonym to either of

Move tests to a separate repository

It makes it easier and better to write tests among the different languages and ensures consistency. We could use a simple syntax similar to SimpleTest. This allows the language to separately interpret the test files, use the language's code to run the test and ensure the correct stuff is matched (and correct regex is generated). The current .rule syntax may be good enough for this.

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.