搜索插件、代码仓与 APP 分类

插件详情v2.6.0

regexpattern

Flutter 正则表达式模式列表及其用于字符串验证的目的

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
4020
喜欢数
129
Pub 分数
150

安装插件

flutter pub add regexpattern

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Flutter 包,提供了一组精心挑选的正则表达式模式,用于字符串验证。每个模式都附有明确的目的,便于在不同平台上实现一致且可靠的输入验证。适用于表单字段、身份验证流程和数据清理,简化了将用户输入与常见验证规则(如电子邮件、电话号码、密码等)匹配的过程。该包支持所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux。

适合场景

  • 表单验证
  • 电子邮件和电话号码检查
  • 密码强度验证
  • 数据输入净化
  • 用户注册流程
  • 文本字段掩码

主要特点

  • 预定义的正则表达式模式
  • 清除目的描述
  • 跨平台兼容性
  • 与 Flutter 表单轻松集成
  • 轻量且专注
  • 开源在 GitHub 上

适合对象

  • 开发表单的开发者
  • 需要输入验证的应用程序
  • 团队统一验证逻辑
  • 面向多个平台的项目
  • 寻求快速验证解决方案的前端开发人员

使用建议

  • 限于预定义的模式
  • 不可按图案自定义
  • 需要手动更新新图案
  • 无内置错误消息
  • 最好配合额外的验证逻辑使用
  • 依赖外部源进行更新

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

RegexPattern

Flutter collection of regex pattern for string validation.

Getting Started

In your flutter project add the dependency:

dependencies:
  ...
  regexpattern: ^2.6.0

Usage

Importing package
import 'package:regexpattern/regexpattern.dart';
Using RegexPattern
Matching string to pattern
bool hasMatch = RegexValidation.hasMatch(<String>, <RegexPattern>);

or

String text = 'https://google.com';
bool isUrl = text.isUrl(); // text.is<Pattern>();
RegexPattern

Collection of regex pattern used to validating data

Pattern username;
Pattern usernameV2;
Pattern usernameGoogle;
Pattern usernameInstagram;
Pattern usernameDiscord;
Pattern email;
Pattern url;
Pattern uri;
Pattern phone;
Pattern hexadecimal;
Pattern vector;
Pattern image;
Pattern audio;
Pattern video;
Pattern txt;
Pattern doc;
Pattern excel;
Pattern ppt;
Pattern apk;
Pattern pdf;
Pattern html;
Pattern dateTimeUTC;
Pattern dateTime;
Pattern binary;
Pattern md5;
Pattern sha1;
Pattern sha256;
Pattern ssn;
Pattern ipv4;
Pattern ipv6;
Pattern isbn;
Pattern github;
Pattern passport;
Pattern currency;
Pattern numericOnly;
Pattern alphabetOnly;
Pattern alphaNumericOnly;
Pattern alphaNumericSymbolOnly;
Pattern noWhitespace;
Pattern passwordEasy;
Pattern passwordNormal1;
Pattern passwordNormal2;
Pattern passwordNormal3;
Pattern passwordHard;
Pattern passwordEasyAllowedWhitespace;
Pattern passwordNormal1AllowedWhitespace;
Pattern passwordNormal2AllowedWhitespace;
Pattern passwordNormal3AllowedWhitespace;
Pattern passwordHardAllowedWhitespace;
Pattern uuid;
Pattern bitcoinAddress;
Pattern bitcoinTaprootAddress;
Pattern bitcoinSegwitAddress;
Pattern ethereumAddress;

CONTRIBUTION

If you wish to contribute, fork this repository and add your regex. Create a PR & i'll check it.

LICENSE

BSD 3-Clause License

Copyright (c) 2020, Agung Nursatria
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

所属分类

源码仓库

使用此插件的项目