1.3.0 • Published 9 years ago

dobi-regex v1.3.0

Weekly downloads
5
License
-
Repository
github
Last release
9 years ago

dobi-regex

A powerful regular expression toolkit for front-end web developers.

Usage

Regular Expression Access
dobi.regex.hex
dobi.regex.youtube_video
dobi.regex.url

String Testing
dobi.regex.is(<string>).a(<regexp key>)
dobi.regex.is(<string>).an(<regexp key>)
dobi.regex.is(<string>, <regexp key>)

Simple Examples
// grab a youtube video id
var youtube_url = "https://www.youtube.com/watch?v=SLjQ1hHZPMU";
var youtube_video_id = dobi.regex.youtube_video.exec(youtube_url)[4]; // returns "SLjQ1hHZPMU"

// check to see if string is an email
var invalid_email = "invalid_email@domain";
var is_email = dobi.regex.is(invalid_email).an.('email'); // returns false

// check to see if a hex is valid
var is_hex = dobi.regex.is('#FFFFFF').a.('hex'); // returns true

Regular Expression Map

keyExample
alphabeticasdfASFDasdf
alphanumericasdf123ASDF123
dailymotion_playlisthttp://www.dailymotion.com/playlist/x3gkwj_TigerTimpani_dance-bands-jazz-4/
dailymotion_videohttp://www.dailymotion.com/video/x2d7qsv_acura-nsx-sneak-peek-video_auto
digit123
emailmy_email@address.org
emoji😬
hex#BBB
instagram_posthttp://instagram.com/p/mrOtidmScU
livestream_streamhttp://www.livestream.com/necn_live
twitch_channelhttp://www.twitch.com/deadmau5
twitch_videohttp://www.twitch.tv/ezekiel_iii/v/3795378
twitter_statushttp://twitter.com/#!/allWPthemes/status/2040410213974016
urlhttps://www.examples.com/page?params=true
ustream_channelhttp://www.ustream.tv/channel/wv-wildlife
ustream_videohttp://www.ustream.tv/recorded/3371638
vine_videohttps://vine.co/v/MgBWtqVBuuY
youku_videohttp://v.youku.com/v_show/id_XODk1ODY5MDAw
youtube_playlisthttps://www.youtube.com/p/19B0B5CCFEF1C0C9
youtube_videohttps://www.youtube.com/e/SLjQ1hHZPMU

Installation

Include the plugin:

<script src="build/dobi-regex.min.js"></script>

License

The MIT License (MIT)

dobi-regex: Copyright (c) 2015 Maestro.io

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

1.3.0

9 years ago