chadselect 0.2.0

Unified data extraction — Regex, XPath 1.0, CSS Selectors, and JMESPath behind one query interface
Documentation

ChadSelect

Unified data extraction — Regex, XPath 1.0, CSS Selectors, and JMESPath behind one query interface.

use chadselect::ChadSelect;

let mut cs = ChadSelect::new();
cs.add_html(r#"<span class="price">$49.99</span>"#.to_string());

let price = cs.select(0, "css:.price");
assert_eq!(price, "$49.99");

Query prefixes

Prefix Engine Content types
regex: Regex All
xpath: XPath 1.0 HTML, Text
css: CSS HTML
json: JMESPath JSON

If no prefix is provided, the query defaults to Regex.

Post-processing functions

Pipe results through text functions using >>:

css:.price >> normalize-space() >> uppercase()
xpath://div/text() >> substring-after('VIN: ')