Crates.io | regex-generator |
lib.rs | regex-generator |
version | 0.1.0 |
source | src |
created_at | 2023-04-19 09:18:48.206157 |
updated_at | 2023-04-19 09:18:48.206157 |
description | permettant la génération d'expressions régulières aléatoire en fonction d'une difficultée choisie. |
homepage | |
repository | |
max_upload_size | |
id | 843365 |
size | 13,559 |
Regex generator est une lib permettant la création d'expressions régulières aléatoire à partir d'un simple chaine de caractère.
fn brebis_regex_with_default_sequence() -> String {
let word = "brebis";
RegexGenerator::full_regex(word, None/*default = Some(2)*/) // [br]{2}[eb]*(is|je|xy)
}
fn brebis_regex_with_sequence_3() -> String {
let word = "brebis";
RegexGenerator::full_regex(word, Some(3)) // [erb]*(hkq|bis|upj|ahj)
}
fn brebis_regex_splited_with_default_sequence() -> Vec<RegexPart> {
let word = "brebis";
RegexGenerator::regexes_splited(word, None)
/* output ->
[
RegexPart { word_part: "br", regex: "(si|br|qn)" },
RegexPart { word_part: "eb", regex: "[eb]+" },
RegexPart { word_part: "is", regex: "[is]{2}" }
]
*/
}