#regex #extracting #group #capture #helper #converting

regex_captures

Helper for extracting and converting regex capture groups

3 unstable releases

0.2.0 Sep 16, 2023
0.1.1 Sep 15, 2023
0.1.0 Jul 3, 2023

#33 in #extracting

Download history 18/week @ 2024-07-19 8/week @ 2024-07-26 13/week @ 2024-08-09 1/week @ 2024-08-16 38/week @ 2024-08-30 10/week @ 2024-09-06 7/week @ 2024-09-13 10/week @ 2024-09-20 18/week @ 2024-09-27 5/week @ 2024-10-04 17/week @ 2024-10-11 23/week @ 2024-10-18 5/week @ 2024-10-25 10/week @ 2024-11-01

55 downloads per month

MIT/Apache

8KB
134 lines

Helper for extracting and converting regex capture groups.


lib.rs:

regex_captures makes it easier to work with capture groups when using the regex crate.

Debugging and type conversions using the regex API can be cumbersome, this crate aims to help with this.

All operations are fallible since we do not guarantee that the requested capture groups exist in the supplied regex.

Error-reporting is prioritized over performance. Using this crate when there are a lot expected failures in matching or parsing leads to extra allocations.

Table of methods:

method capture_type conversion total?
get numeric From<str> yes
parse_get numeric FromStr no
try_get numeric TryFrom<str> no
name named From<str> yes
parse_name named FromStr no
try_name named TryFrom<str> no

Examples using all methods:

Dependencies

~2.4–4MB
~71K SLoC