├── .gems ├── public └── favicon.ico ├── javascripts ├── src │ ├── constants.yml │ ├── lib │ │ ├── extensions.js │ │ ├── jquery.inline_labels.js │ │ └── jquery.autoSizeFontSize.js │ ├── rejex.js │ ├── app.js │ ├── pattern_matcher.js │ ├── translator.js │ └── vendor │ │ ├── augment-0.1.0.min.js │ │ └── jquery-1.6.min.js └── dist │ └── rejex.min.js ├── config.ru ├── Rakefile ├── readme.txt ├── views ├── cache_manifest.erb ├── main.sass └── index.haml ├── rejex.rb └── lib └── bundle.rb /.gems: -------------------------------------------------------------------------------- 1 | sinatra --version 1.0 2 | haml --version 3.0.4 3 | grit -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/olivernn/rejex/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /javascripts/src/constants.yml: -------------------------------------------------------------------------------- 1 | --- 2 | VERSION: a99108ac87983e507bd79a8cc037ce0f55b0ae80 3 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | require 'rejex' 2 | use Rack::Static, :urls => ["/javascripts"] 3 | run Sinatra::Application -------------------------------------------------------------------------------- /javascripts/src/lib/extensions.js: -------------------------------------------------------------------------------- 1 | Array.wrap = function (obj) { 2 | if (Array.isArray(obj)) { 3 | return obj 4 | } else if (typeof(obj) == "undefined") { 5 | return [] 6 | } else { 7 | return [obj] 8 | }; 9 | } -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | autoload :Bundle, 'lib/bundle' 2 | 3 | task :default => :test 4 | 5 | desc 'Bundle source files.' 6 | task :bundle do 7 | @bundle = Bundle.new 8 | @bundle.bundle! 9 | end 10 | 11 | desc 'Minify bundled source.' 12 | task :minify => :bundle do 13 | @bundle.minify! 14 | end 15 | -------------------------------------------------------------------------------- /javascripts/src/rejex.js: -------------------------------------------------------------------------------- 1 | /* Rejex JavaScript Application, version <%= VERSION %> 2 | * (c) 2010 Oliver Nightingale 3 | * 4 | * Released under MIT license. 5 | */ 6 | //= require "vendor/augment-0.1.0.min.js" 7 | //= require "vendor/jquery-1.6.min.js" 8 | //= require "lib/extensions.js" 9 | //= require "lib/jquery.inline_labels.js" 10 | //= require "lib/jquery.autoSizeFontSize.js" 11 | //= require "pattern_matcher.js" 12 | //= require "app.js" 13 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | _ __ __ /\_\ __ __ _ 2 | /\`'__\/'__`\\/\ \ /'__`\/\ \/'\ 3 | \ \ \//\ __/ \ \ \/\ __/\/> 4 | \ \_\\ \____\_\ \ \ \____\/\_/\_\ 5 | \/_/ \/____/\ \_\ \/____/\//\/_/ 6 | \ \____/ 7 | \/___/ 8 | 9 | the JavaScript regular expression editor 10 | 11 | 1. Type in your regular expression. 12 | 2. Choose any options, i - case insensitive, g - global matching, m - multiline matching. 13 | 3. Enter your test string. 14 | 4. See matches. -------------------------------------------------------------------------------- /views/cache_manifest.erb: -------------------------------------------------------------------------------- 1 | CACHE MANIFEST 2 | # version: <%= @version %> 3 | NETWORK: 4 | http://www.google-analytics.com/ga.js 5 | CACHE: 6 | /favicon.ico 7 | <% if Sinatra::Application.environment == :production %> 8 | /javascripts/dist/rejex.min.js 9 | <% else %> 10 | /javascripts/src/vendor/jquery-1.6.min.js 11 | /javascripts/src/vendor/augment-0.1.0.min.js 12 | /javascripts/src/lib/jquery.inline_labels.js 13 | /javascripts/src/pattern_matcher.js 14 | /javascripts/src/app.js 15 | <% end %> 16 | /main.css 17 | http://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png -------------------------------------------------------------------------------- /rejex.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'sinatra' 3 | require 'haml' 4 | require 'erb' 5 | require 'grit' 6 | 7 | include Grit 8 | 9 | set :haml, { :format => :html5 } 10 | 11 | # caching for one month 12 | 13 | get '/' do 14 | cache_control :public => true, :max_age => 2629743 15 | haml :index 16 | end 17 | 18 | get '/main.css' do 19 | cache_control :public => true, :max_age => 2629743 20 | sass :main 21 | end 22 | 23 | get '/cache.manifest' do 24 | content_type 'text/cache-manifest' 25 | if Sinatra::Application.environment == :production 26 | @version = ENV['COMMIT_HASH'] 27 | else 28 | @version = Repo.new(Sinatra::Application.root).commits.first 29 | end 30 | erb :cache_manifest 31 | end -------------------------------------------------------------------------------- /javascripts/src/lib/jquery.inline_labels.js: -------------------------------------------------------------------------------- 1 | jQuery.fn.inlineLabels = function() { 2 | return this.each(function(options){ 3 | var settings = jQuery.extend({ 4 | opacity: 0.5, 5 | speed: 400 6 | }, options); 7 | 8 | var $input = jQuery(this) 9 | var labelId = '#' + jQuery(this).attr('id') + '_label'; 10 | var $label = jQuery(labelId) 11 | 12 | jQuery(this).focus(function () { 13 | if ($input.val()) { 14 | $label.animate({ 15 | opacity: 0 16 | }, settings['speed']); 17 | } else { 18 | $label.animate({ 19 | opacity: settings['opacity'] 20 | }, settings['speed']); 21 | }; 22 | }); 23 | 24 | $input.bind('keydown keyup', function (event) { 25 | if ($input.val()) { 26 | $label.css('opacity', 0) 27 | }; 28 | }); 29 | 30 | $input.blur(function () { 31 | if (!$input.val()) { 32 | $label.animate({ 33 | opacity: 1 34 | }, settings['speed']) 35 | }; 36 | }); 37 | }); 38 | }; -------------------------------------------------------------------------------- /javascripts/src/app.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | $('input, textarea').inlineLabels() 3 | $('#expression').autoScaleFontSize() 4 | 5 | // display the options help 6 | $('#options').focus(function () { 7 | $('#options_help').animate({ 8 | opacity: 1 9 | }, 400); 10 | }).blur(function () { 11 | $('#options_help').animate({ 12 | opacity: 0 13 | }, 400); 14 | }); 15 | 16 | // highlight any matches and display them 17 | $('form').find('input, textarea').keyup(function (e) { 18 | // don't try and do any highlighting when pressing the tab key 19 | if ($('#expression').val()) { 20 | var p = new PatternMatcher ({ 21 | pattern: $('#expression').val(), 22 | testString: $('#test_string').val(), 23 | regExpOptions: $('#options').val() 24 | }); 25 | 26 | $('#matches_text').html(p.highlight()); 27 | $("#matches_label").hide() 28 | 29 | var groups = $("#captured").empty() 30 | p.matches().forEach(function (group) { 31 | groups.append("
| t |