7 releases

0.3.1 Mar 16, 2022
0.3.0 Sep 24, 2021
0.2.1 Sep 22, 2021
0.1.2 Jun 16, 2021
0.1.1 Aug 16, 2020

#586 in Text processing

Download history 854/week @ 2024-12-16 655/week @ 2024-12-23 266/week @ 2024-12-30 901/week @ 2025-01-06 933/week @ 2025-01-13 940/week @ 2025-01-20 1242/week @ 2025-01-27 1118/week @ 2025-02-03 1089/week @ 2025-02-10 1975/week @ 2025-02-17 1280/week @ 2025-02-24 1261/week @ 2025-03-03 952/week @ 2025-03-10 574/week @ 2025-03-17 781/week @ 2025-03-24 645/week @ 2025-03-31

3,019 downloads per month
Used in 8 crates (2 directly)

Apache-2.0

34KB
678 lines

like

Apache-2.0 licensed Crate API

A SQL like style pattern matching.

Usage

To do a patten matching, use Like:

use like::Like;

// Has Escape
assert!(Like::<true>::like("Hello, world!", "Hello%").unwrap());
// No Escape
assert!(Like::<false>::like("Hello, world!", "Hello%").unwrap());

To do a case-insensitive pattern matching, use ILike:

use like::ILike;

// Has Escape
assert!(ILike::<true>::ilike("Hello, world!", "HELLO%").unwrap());
// No Escape
assert!(ILike::<false>::ilike("Hello, world!", "HELLO%").unwrap());

To convert the pattern to use standard backslash escape convention, use Escape:

use like::Escape;

assert_eq!("Hello$%".escape("$").unwrap(), "Hello\\%");

Rust Version

This version of like requires Rust 1.57 or later.

License

This project is licensed under the Apache-2.0 license (LICENSE or http://www.apache.org/licenses/LICENSE-2.0).

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in like by you, shall be licensed as Apache-2.0, without any additional terms or conditions.

No runtime deps