Code Monkey home page Code Monkey logo

localregex's Introduction

style: very good analysis License: MIT Coverage

This plugin allows developers to check if an input matches common regex patterns in Zimbabwe and other countries. This plugin works for all Flutter supported platforms i.e. Android, iOS, Web and Desktop (Linux, Windows & MacOS).

Developed by Ngonidzashe Mangudya. Special shoutout to Kudakwashe Kuzvindiwana & Donald Chinhuru for pushing this package the most.

Usage

Add dependency

dependencies:
  localregex: <version>

Or

flutter pub add localregex

Import package

  import 'package:localregex/localregex.dart';

Note that declaration and initialization is no longer necessary

Check if a mobile number matches patterns for Econet, Netone or Telecel numbers

LocalRegex.isNetone('mobile_number');
LocalRegex.isEconet('mobile_number');
LocalRegex.isTelecel('mobile_number');

Check if a mobile number matches any of the patterns for Econet, Netone or Telecel

LocalRegex.isZimMobile('mobile_number');

Check if mobile number is valid (recommended for numbers not from Zimbabwe)

LocalRegex.isValidMobile('mobile_number');

Check if Zimbabwean landline number is valid

LocalRegex.isZimLandline('landline_number');

Check if a supplied email matches proper email patterns

LocalRegex.isEmail('email_address');

Check if a supplied national id matches the pattern for Zimbabwean national id

LocalRegex.isZimID('national_id');

Check passport number

LocalRegex.isZimPassport('passport_number');

Check number plate

LocalRegex.isZimNumberPlate('number_plate');

Check driver's license

LocalRegex.isZimDriversLicence('drivers_license');

Check URL

LocalRegex.isUrl("https://www.google.com");

Check phone number and returns phone number in required format (for use with Zim numbers only)

String? number = '+263777213388'.formatNumber(formatType: FormatType.regular);

Check if password is valid (minimum of 8 characters, at least 1 special character, 1 capital letter, 1 numeric character)

LocalRegex.isPassword('your_password');

Mobile Number Format Types

Regular

This is the general format of mobile numbers e.g. 0777213388

FormatType.regular

Country Code

This is the mobile number format with country code but no + sign e.g. 263777213388

FormatType.countryCode

Country Code Plus

This is the mobile number format with country code and + sign e.g. +263777213388

FormatType.countryCodePlus

Format National ID

Here the output format to be used is 11-223344 K 55 as found on most national identity documents in Zimbabwe

'11223344K55'.formatID(formatType: IdFormatType.proper); // > 11-223344 K 55

School Student IDs

You can validate Student IDs for multiple tertiary institutions in Zimbabwe.

LocalSchools.hit.isStudent('studentID')

Contributors


Ngonidzashe Mangudya

Kudakwashe Kuzvindiwana

Donald Chinhuru
Add your contributions

localregex's People

Contributors

iamngoni avatar kudak3 avatar allcontributors[bot] avatar donnc avatar

Stargazers

 avatar  avatar  avatar  avatar Alistair Holmes avatar Bukhosi Moyo avatar

Watchers

 avatar

localregex's Issues

National ID Number

national id number format is enforcing to pick 6 digits after a hyphen or after the first 2 digits but there is a difference between the number of digits after the first 2 or hyphen between the old IDs and the new IDs. The isZimbabwean(...) method is returning false on valid old ID numbers with 7 digits after the hyphen

ID Format.nospace appending ID letter

Found out that for other id numbers, its appending the id letter on the formatted id number, case in point is as below
i printed on console, the values of these variables

image

output is as below
image

the Z is being added as ZZ for a valid ID number

ID Formats

Great progress on id validation and format

var _id = '11223344K55'.formatID(); // > 11-223344 K 55

Can you add additional format like with out a hyphen and spaces sort of
1 can do this with extension but will be good if the package comes with some of these formats built-in

// for example
var _id = '11223344K55'.formatID(FormatIdType.nospace); // > 11223344K55

FormatType and extensions not being picked

When copy pasting example code, the FormatType and extensions are not being picked for import.

// cant import 
final ff = '88393'.formatNumber(FormatType.regular);
// working fine with import 
final isNumValid= LocalRegex.isZimMobile(editingController.text);

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.