regexpattern 0.2.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 88

RegexPattern #

Flutter collection of regex pattern with purpose for string validation.

Getting Started #

In your flutter project add the dependency:

dependencies:
  ...
  regexpattern: ^0.2.3

Usage #

Importing package

import 'package:regexpattern/regexpattern.dart';

Using RegexPattern

Matching string to pattern

bool hasMatch = RegexValidation.hasMatch(<String>, <RegexPattern>);

RegexPattern #

Collection of regex pattern used to validating data

Pattern username;
Pattern email;
Pattern url;
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 basicDateTime; // Date time in UTC and Iso8601
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 passwordEasy;
Pattern passwordNormal1;
Pattern passwordNormal2;
Pattern passwordNormal3;
Pattern passwordHard;
Pattern passwordEasyAllowedWhitespace;
Pattern passwordNormal1AllowedWhitespace;
Pattern passwordNormal2AllowedWhitespace;
Pattern passwordNormal3AllowedWhitespace;
Pattern passwordHardAllowedWhitespace;

[0.2.3] - 04/30/2020 #

  • Add comment in regex_pattern.dart

[0.2.2] - 04/30/2020 #

  • Add regex pattern password with allowed whitespace.

[0.2.1] - 04/30/2020 #

  • Update readme.md.

[0.2.0] - 04/30/2020 #

  • Add regex pattern password.

[0.1.2] - 04/28/2020 #

  • Update license.

[0.1.1] - 04/28/2020 #

  • Renaming document regex var to doc.

[0.1.0] - 04/28/2020 #

  • Initial Release.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:regexpattern/regexpattern.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Regex Pattern Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Regex Pattern Example Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    String url = 'https://google.com';
    bool isMatch = RegexValidation.hasMatch(url, RegexPattern.url);
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              'isUrl - $url: $isMatch',
            ),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  regexpattern: ^0.2.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:regexpattern/regexpattern.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
77
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
88
Learn more about scoring.

We analyzed this package on Jul 8, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [regexpattern] that is in a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.1
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies
flutter_test