verbal_expressions 0.3.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 81

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 = new 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 = new 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 = new VerbalExpression()
	  ..wordChar()..nonWordChar()
	  ..space()..nonSpace()
	  ..digit()..nonDigit();

Define captures:

  var expression = new 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) ]

Changelog

0.3.1

  • Added .analysis_options and fixed common problems

0.3.0

  • breaking change: do not capture groups if it is not set explicitly using beginCapture/endCapture. More details
  • fixed group capturing
  • added lazy quantifiers
  • added Macintosh line break

0.2.0

  • breaking change: builder pattern approach replaced with method cascades. More details
  • set global search by default

0.1.0

  • Initial version, created by Ne4istb

hi everybody, i'm trying to publish new version of my package but both ```pub publish --dry-run

1. Depend on it

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


dependencies:
  verbal_expressions: "^0.3.1"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:verbal_expressions/verbal_expressions.dart';
        
Version Uploaded Documentation Archive
0.3.1 Jan 14, 2017 Go to the documentation of verbal_expressions 0.3.1 Download verbal_expressions 0.3.1 archive
0.3.0 Mar 10, 2016 Go to the documentation of verbal_expressions 0.3.0 Download verbal_expressions 0.3.0 archive
0.2.0 Jan 19, 2016 Go to the documentation of verbal_expressions 0.2.0 Download verbal_expressions 0.2.0 archive
0.1.0 Jan 16, 2016 Go to the documentation of verbal_expressions 0.1.0 Download verbal_expressions 0.1.0 archive

Analysis

We analyzed this package on Apr 23, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.49.0
  • pana: 0.10.6

Scores

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

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:verbal_expressions/verbal_expressions.dart.

Suggestions

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 2 hints.

    Run dartfmt to format lib/src/range.dart.

    Run dartfmt to format lib/src/verbal_expression.dart.

  • Use analysis_options.yaml.

    Rename old .analysis_options file to analysis_options.yaml.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0
Dev dependencies
test >=0.12.0 <0.13.0