パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v1.0.0

verbal_expressions

難しい正規表現を構築するのを助けるパッケージ。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
71
いいね数
20
Pub ポイント
160

パッケージをインストール

flutter pub add verbal_expressions

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

VerbalExpressions は、読みやすく流れのある API を通じて複雑な正規表現の作成を簡素化することを目的とした Dart パッケージです。開発者は直感的なメソッドチェーンを使って段階的に正規表現パターンを構築でき、エラーの可能性を低くし、コードの保守性を向上させます。構造化されたテキストの解析や入力フォーマットの検証に最適で、生の正規表現構文の複雑さを抽象化しつつも完全な機能性を保持しています。このパッケージはすべての主要プラットフォームをサポートしており、クロスプラットフォームアプリケーションに非常に有用です。

用途

  • テキストパターン検証
  • 入力のサニタイズ
  • 文字列からのデータ抽出
  • 構造化ログの解析
  • 再利用可能な正規表現ビルダの構築

主な機能

  • スムーズでチェーン可能な API
  • 読みやすく保守可能な正規表現の構築
  • すべての標準的な正規表現操作をサポートしています
  • クロスプラットフォーム互換性
  • Flutterアプリへの簡単な統合

適している対象

  • フォームバリデーターを構築する開発者
  • コードの可読性を最優先とするチーム
  • 動的な正規表現生成を必要とするプロジェクト
  • ユーザー入力またはログデータを処理するアプリケーション

注意事項

  • 純粋な正規表現と比較してわずかなオーバーヘッドを追加する可能性があります
  • 非常に単純なパターンには適していない
  • 基本的な正規表現の概念を理解している必要があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Pub Package Build Status Coverage Status Github Issues

verbal_expressions

A library for Dart developers that helps to construct difficult regular expressions.

Dart package info is here: https://pub.dartlang.org/packages/verbal_expressions

Quick start

  var regex = VerbalExpression()
   ..startOfLine()
   ..then("http").maybe("s")
   ..then("://")
   ..maybe("www.").anythingBut(" ")
   ..endOfLine();

  // Create an example URL
  String url = "https://www.google.com";

  // Use VerbalExpression's hasMatch() method to test if the entire string matches the regex
  regex.hasMatch(url); //True

  regex.toString();   // Outputs the regex used: ^http(s)?\\:\\/\\/(www\\.)?([^\\ ]*)\$

  var regex = VerbalExpression()..startOfLine()..then("abc")..or("def");

  var testString = "defzzz";
  //Use VerbalExpression's hasMatch() method to test if parts if the string match the regex
  regex.hasMatch(testString);   // true

Feel free to use any predefined char groups:

  var regex = VerbalExpression()
	  ..wordChar()..nonWordChar()
	  ..space()..nonSpace()
	  ..digit()..nonDigit();

Define captures:

  var expression = VerbalExpression()
   ..find("a")
   ..beginCapture()..find("b")..anything()..endCapture()
   ..then("cd");
   
  RegExp regex = expression.toRegExp();

  var match = regex.firstMatch(text);
  print(match.group(0)); // returns "abcd"
  print(match.group(1)); // returns "b"

Examples

More examples are in example file

Features and bugs

Please find feature requests and bugs at the issue tracker.

Other implementations

You can view all implementations on VerbalExpressions.github.io

[ Javascript - PHP - Python - C# - Objective-C - Ruby - Groovy - Haskell - C++ - ... (moarr) ]

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。