Skip to content

amireh/PCREck

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
bin
 
 
 
 
lib
 
 
 
 
 
 
ui
 
 
 
 
 
 
www
 
 
 
 
 
 
 
 
 
 
 
 
 
 

rgx

An interface for writing and checking PCRE regular expressions. rgx is similar to what Rubular is for Ruby's regexes.

Spec

Capture sample

{
  "offset": Array(Number, Number),
  "captures": Array(Array(Number,Number)),
  "status": "RC_MATCH"
}

Bad pattern sample

{
  "status": "RC_BADPATTERN",
  "error": String
}

The Lua part

Uses lrexlib-pcre to test a PCRE pattern on a subject.

The script can be invoked with a pattern and a subject to test and the results will be thrown out to STDOUT in either readable, formatted way (default) or a compact one (--compact).

The script can also be daemonized (-d) to accept newline-delimited JSON array messages that contain the pattern as the first element and the subject as the second one.

Dependencies

You can get all the dependencies using luarocks. They are:

  • lrexlib-pcre
  • lua_cliargs
  • dkjson
  • luasocket (only when using the daemonized mode)
  • luasignal (only when using the daemonized mode)

The Ruby part

A minial Sinatra Ruby server that accepts GET '/' for displaying the HTML interface, and POST '/' for invoking rgx.lua in the compact mode and passing the result back as JSON.

Dependencies

  • the Sinatra gem
  • dm-core
  • dm-migrations
  • dm-mysql-adapter

The HTML interface

It's composed of a simple HTML view and a CSS file. The only JavaScript dependency is jQuery.

I plan on using WebSockets instead of AJAX for querying later on at which point the jQuery dependency can be safely removed.

Licensing

This file is part of rgx.

rgx is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

rgx is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with rgx. If not, see http://www.gnu.org/licenses/.

About

A web interface for PCRE regular expression writing and checking.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published