Giter Site home page Giter Site logo

craft-matchinput's Introduction

Match Input plugin for Craft CMS 4.x and 5.x

Craft field type for text fields that match a regex pattern.

Installation

To install Match Input, follow these steps:

  1. Install with Composer via composer require born05/craft-matchinput from your project directory
  2. Install plugin in the Craft Control Panel under Settings > Plugins

or

  1. Install via the Plugin Store

Match Input works on Craft 4.x and Craft 5.x.

Match Input Overview

A Match Input field is a Plain Text field with the addition of a regex pattern that the field must match to be valid.

Using Match Input

When you create the field, you specify the Input Mask. This is the PCRE Pattern which the input is required to match. You also specify an Error Message to display when the field does not match the pattern.

If you need to translate the Error Message (for a multi-language control panel), those translations will be in the site translation category.

Sample Input Masks

  • https:// - not a valid pattern (no delimiters)
  • /https:\/\// - valid pattern, will match string with https:// in it anywhere
  • #https://# - valid pattern, will match string with https:// in it anywhere (sometimes / isn't the best delimiter)
  • #^https://# - will match string that begins with https://
  • /^\d{5}(-\d{4})?$/ - will match 5 digits, optionally followed by - and 4 digits (uses ^ and $ to match the entire string)

Acknowledgements

Forked from Marion Newlevant's Match Input plugin.

craft-matchinput's People

Contributors

brandonkelly avatar makeilalundy avatar marionnewlevant avatar roelvanhintum avatar

Watchers

 avatar

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.