Skip to content

applidium/regex_field

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RegexField

Regex field for Rails FormHelper. The colorization of the regex is performed by https://github.com/slevithan/regex-colorizer.

Usage

Simply call regex_field on your form helper to generate a text field with regex highlighting. Here's an example:

<%= form_for(@record) do |f| %>
  <%= f.regex_field :attr %>
<% end %>

Installation

Add this line to your application's Gemfile:

gem 'regex_field'

And then import the javascript in app/assets/stylesheets/application.scss:

//= require regex_field

If you work with the bootstrap_form gem, you can refer to this open issue to enable Bootstrap layout on the regex field.

License

The gem is available as open source under the terms of the MIT License.