0.0
No commit activity in last 3 years
No release in over 3 years
Add a regex field on Rails form helper
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 4.2.0, < 6
 Project Readme

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.