prexp 0.1.0 copy "prexp: ^0.1.0" to clipboard
prexp: ^0.1.0 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/Seven, {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
0
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

License

unknown (license)

More

Packages that depend on prexp