prexp 0.1.2 copy "prexp: ^0.1.2" to clipboard
prexp: ^0.1.2 copied to clipboard

discontinuedreplaced by: routingkit

Convert the path string to a regular expression, such as `/users/:name` and the like.

example/prexp_example.dart

import 'package:prexp/prexp.dart';

void main() {
  final String route = r'/users/:name';

  final Prexp prexp = Prexp.fromString(route);
  print(prexp.hasMatch('/users/odroe')); // true

  final PathMatcher matcher = PathMatcher.fromPrexp(prexp);
  print(matcher('/users/odroe')); // (PrexpMatch(/users/odroe, {name: Seven}))

  final PathBuilder builder = PathBuilder.fromPath(route);
  print(builder({'name': 'odroe'})); // /users/odroe

  print(Prexp.parse(
      route)); // [StringPrexpToken(/users), MetadataPrexpToken({"name":"name","prefix":"/","suffix":"","pattern":"[^\\/#\\?]+?","modifier":""}]
}
1
likes
160
pub points
4%
popularity

Publisher

verified publisherodroe.com

Convert the path string to a regular expression, such as `/users/:name` and the like.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on prexp