MCPcopy Create free account
hub / github.com/LeeeSe/MessAuto / extract_candidate_codes

Function extract_candidate_codes

src/parser.rs:39–54  ·  view source on GitHub ↗
(text: &str, pattern: &str)

Source from the content-addressed store, hash-verified

37}
38
39fn extract_candidate_codes(text: &str, pattern: &str) -> Vec<(String, usize)> {
40 let re = Regex::new(pattern).unwrap();
41 let mut candidates = Vec::new();
42
43 for result in re.find_iter(text) {
44 if let Ok(mat) = result {
45 let code = mat.as_str();
46 if code.chars().any(|c| c.is_ascii_digit()) {
47 let pos = mat.start();
48 candidates.push((code.to_string(), pos));
49 }
50 }
51 }
52
53 candidates
54}
55
56fn filter_candidates_step1(candidates: Vec<(String, usize)>, _text: &str) -> Vec<(String, usize)> {
57 let mut filtered = Vec::new();

Callers 1

Calls 1

startMethod · 0.80

Tested by

no test coverage detected