패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.0.3

flutter_regex

정규 표현식 라이브러리는 이모티콘, 50개 이상의 국가 ID, 사용자 이름, 이메일, URL, 이미지 형식, 날짜 및 시간, CVV, 공백 패턴을 포함하여 1000개 이상의 다른 패턴도 지원합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
2.1천
좋아요
50
Pub 점수
145

패키지 설치

flutter pub add flutter_regex

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

flutter_regex는 이메일, URL, 사용자 이름, 날짜, CVV, 이미지 형식, 국가 ID와 같은 일반적인 패턴에 대해 즉시 사용 가능한 정규 표현식을 제공하는 Flutter용 포괄적인 텍스트 검증 라이브러리입니다. 이모지 및 공백 처리도 지원하여 폼 검증과 입력 정제에 이상적입니다. 1000개 이상의 사전 정의된 패턴을 통해 여러 플랫폼에서 복잡한 정규 표현식 구현을 간소화합니다. 이 패키지는 활발히 유지보수되고 오픈 소스이며 Android, iOS, Web, macOS, Windows, Linux를 지원합니다.

사용 사례

  • 폼 입력 검증
  • 이메일 및 URL 검증
  • 사용자 인증 흐름
  • 데이터 세정
  • 날짜 및 시간 파싱
  • 이미지 형식 확인

주요 기능

  • 50개 이상의 국가 ID를 지원합니다
  • 이모티콘 및 공백 패턴을 포함합니다
  • 1000개 이상의 사전 정의된 정규 표현식 패턴
  • 크로스 플랫폼 호환성
  • pub를 통한 간편한 통합
  • GitHub에서 오픈소스

적합한 대상

  • 양식을 개발하는 개발자
  • 엄격한 입력 검증이 필요한 앱
  • 국제화된 애플리케이션
  • 텍스트 처리 기능을 갖춘 모바일 및 웹 앱
  • 재사용 가능한 정규 표현식 유틸리티를 찾는 팀

고려 사항

  • 큰 패턴 세트로 인해 앱 크기가 증가할 수 있습니다
  • 정규 표현식 기본 사항을 이해해야 합니다
  • 매우 높은 성능 시나리오에 최적화되지 않음
  • 패턴당 제한된 사용자 정의
  • 표준 검증 요구 사항에 가장 적합

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Flutter Regex Plugin

The flutter_regex plugin provides comprehensive support for a wide range of regular expression patterns, including basic data validation for usernames, emails, and passwords, support for over 50 country ID regex patterns, and various other specialized patterns for different data formats.

Features

  • Regex pattern for emojis(😊).
  • Support for 50+ country ID regex patterns.
  • Supports usernameV2, usernameGoogle, usernameInstagram, and usernameDiscord patterns.
  • Supports email and url patterns.
  • Supports webp format for image patterns.
  • Supports basicDateTime pattern.
  • Supports dateTimeUTC and dateTime patterns.
  • Supports cvv and noWhitespace patterns.
  • Supports uuid, bitcoinAddress, bitcoinTaprootAddress, bitcoinSegwitAddress, and ethereumAddress patterns.
  • Supports regex patterns for stock exchanges: NYSE, NASDAQ, TSE, SSE, HKEX, Euronext, LSE, SZSE, TSX, BSE.
  • Supports regex patterns for UUID, MAC address, credit card number, YouTube video ID, Twitter username, Roman numerals, Sudoku puzzles, DNA sequences, time (12-hour and 24-hour format), positive and negative integers, decimal and floating-point numbers, base64 encoded string, JWT ( JSON Web Token), RGB and HSL color codes, SQL statements, ISIN, GPG key ID, MIME types, phone numbers (U.S. format), JSON objects and arrays, CSS selectors, octal numbers, scientific notation, PHP blocks, Python function declarations, IBAN, IMEI, ISMN, and various postal code formats.
  • Supports regex pattern for latitude-longitude coordinates (decimal), Google Analytics tracking ID, Google Cloud Storage URI, JDBC connection string, pangram.
  • Supports 1000+ famous and commonly used regex patterns.
  • Added support for 110 plus country currency symbols and codes.
  • Updated email validator which supports the format of an email address.
  • Added various new regex patterns for matching palindromes, prime numbers, balanced parentheses, Morse code, Fibonacci numbers, SSID names, MAC addresses, WEP keys, WPA keys, network names, signal strength, and WiFi channel numbers.

Usage

To use the flutter_regex plugin, add it to your pubspec.yaml file:

dependencies:
  flutter_regex: ^0.0.3

Then, import the package in your Dart code:

import 'package:flutter_regex/flutter_regex.dart';

You can then use the various regex patterns provided by the plugin to validate your data.


Now you are ready to use this plugin, let's see this with the most used 15 examples,

  1. Username, Email, Phone Number, or all normal form fields
String email = 'abc@gmail.com';
String phoneNumber = '+91 9999999999';

bool isEmailMatch = email.isEmail();
bool isPhoneNumberMatch = phoneNumber.isPhone();

Also allows top-level domain

String emailSt = 'user@sub.exämple.com';
bool isStEmailMatch = emailSt.isEmail(supportTopLevelDomain: true); //true
  1. Password (Simple, Normal, Hard)
// Simple
String easyPassword = 'abcdefgh';
bool isPasswordMatch = easyPassword.isPasswordEasy();

// Normal
String normalPassword = 'admin123';
bool isPasswordMatch = normalPassword.isPasswordNormal1();

// Hard
String hardPassword = 'Admin123!';
bool isPasswordMatch = hardPassword.isPasswordHard();

Also, there are 2–3 more regex for the all-type password and space support option as well.

  1. Emoji (😂)
String emoji = '😂';
bool isEmojiMatch = emoji.isEmoji();

All common emojis supported like, 😂 ❤️ 😍 😊 😭 😘 🥺 🤔 💕 😩 ✨ 🎉 🙏 😊 🎶 😁 😔 😎 😬 🤣 🌟 😢 💔 🥰 🌹 💖 🙌 🤗 💙 😅 🎊 🎁 😌 😪 😅 😳 😤 🥴 🙃 🎵 😓 😖 😞 😇 😜 😋 😡

  1. Social ID(Google, Twitter, YouTube, Discord, etc.)
String usernameGoogle = 'Shirsh123';
bool isUsernameGoogleMatch = usernameGoogle.isUsernameGoogle(); // same for Instagram, Discord etc.
  1. Currencies(dollar 💵, Rupees ₹, euro 💶 and 110 + country) and Crypto Currencies(Bitcoin, Ethereum)
String currency = '€'; // Support Euro, dollar, rupee, and 110+ country
bool isCurrencyMatch = currency.isCurrencySymbolRegex();

Also allows Currency Code Pattern

String currencyCode = 'EUR';
bool isCurrencyCodeMatch = currencyCode.isCurrencyCodePattern(); //true
  1. International IDs(ISIN, IBAN, IMEI, ISMN, etc.)
// ISIN (International Securities Identification Number)
String isin = 'INE0J1Y01017';
bool isISINMatch = isin.ISIN();

International Standard Book Number (ISBN)

String isbn = '978-93-5300-895-6';
bool isISBNMatch = isbn.ISBN();

Same as we can check IMEI (International Mobile Equipment Identity) number and ISMN (International Standard Music Number) etc.

  1. URL, URI, UUID
String url = 'http://www.example.com/index.html';
bool isUrlMatch = url.isUrl();

String uri = 'https://google.com';
bool isUriMatch = uri.isUri();

String uuid = '550e8400-e29b-41d4-a716-446655440000';
bool isUuidMatch = uuid.isUUID();
  1. Date 📅 Time ⏲ with different formats.
String dateTime = 'Wednesday, 24 June 2023';
bool isDateTimeMatch = dateTime.isDateTime();

String dateTimeUTC = '2021-04-27 03:16:39';
bool isDateTimeUTCMatch = dateTimeUTC.isDateTimeUTC();
  1. Popular documents types(doc, excel, audio, video, txt, ppt, ipa, apk, pdf, etc.)
String ppt = 'abc123Slide.ppt';
bool isPPTMatch = ppt.isPPT();

Same as for doc, excel, audio, video, txt, ipa, apk, pdf, etc.

  1. Security keys (sha 1, sha 256, ssn, ipv4, ipv6, etc.)
String sha1 = '5e13ae4640ae4ae0e09c05b7bb060f544dabd042';
bool isSHA1Match = sha1.isSHA1();

Same as for sha 256,

ssn, ipv4, ipv6, etc.

  1. Colors (RGB, HSL, etc.)
String rgbColor = 'rgb(256, 2, 0)';
bool isRgbColorMatch = rgbColor.isRgbColorCode();

String hslColor = 'hsl(0, 100%, 50%)';
bool isHslColorMatch = hslColor.isHslColorCode();
  1. JSON(JSON object, JSON array, JWT)
// JSON object
String jsonObject = '{"name": "John", "age": 30}';
bool isJsonObjectMatch = jsonObject.isJsonObject();

// JSON Array
String jsonArray = '["apple", "banana", "orange"]';
bool isJsonArrayMatch = jsonArray.isJsonArray();

// JSON Web Token
String jwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
bool isJWTMatch = jwt.isJwt();
  1. Postal code(USA, Indian, Japanese, German, French, etc.)
String indianPostalCode = '452006';
bool isIndianPostalCodeMatch = indianPostalCode.isIndianPostalCode();

Same as for Japanese, German, French, etc.

  1. Government IDs(License, Passport, voters ID and 10 plus)
String passportNumberIndia = 'AB12345'; // Just an example of Passport Number
bool isPassportNumberIndiaMatch = passportNumberIndia.isPassportNumberIndia();

Same as India, United States, China, Japan, Germany, United Kingdom, France, Italy, Canada, South Korea, Russia, Spain, Australia, Brazil, Mexico, Indonesia, Netherlands, Saudi Arabia, Turkey, Switzerland, Taiwan, Sweden, Poland, Belgium, Thailand, Iran, Austria, Norway, United Arab Emirates, Nigeria, Israel, South Africa, Hong Kong, Denmark, Singapore, Malaysia, Philippines, Colombia, Egypt, Finland, Chile, Ireland, Pakistan, Greece, Portugal, Vietnam 50 plus country's top 10 ID supported

  1. Credit card (15 &16 digits both also space supports) 💳
String passportNumber = '4111 1111 1111 1111'; // 16 and 15 digit also space supported
bool isPassportNumberMatch = passportNumber.isCreditCard();

For more details, check out the API documentation.

Getting Started

For help getting started with Flutter, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

License

The MIT License (MIT) Copyright (c) 2024 Shirsh Shukla

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.

카테고리

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.