feat: thinking in new api for search

上级 1b984722
......@@ -14,7 +14,7 @@ for examples:
- ONIG_REGSET_POSITION_LEAD (returns most left position)
- ONIG_OPTION_CAPTURE_GROUP named and no-named group captured.
## Decision
......
use onig::Regex;
use onig::{Regex, SearchOptions};
use unicode_segmentation::UnicodeSegmentation;
#[derive(Debug, Clone, Serialize)]
......@@ -68,6 +68,10 @@ impl Scanner {
let regex = _regex.unwrap();
let mut capture_indices = vec![];
let _captures = regex.captures(after_pos_str.as_str());
let zz = regex.search_with_options(&*origin_str.clone(), start_pos as usize, origin_str.clone().len(), SearchOptions::SEARCH_OPTION_NOTBOL, None);
if let Some(pos) = zz {
println!("pos: {:?}", pos);
}
if let Some(captures) = _captures {
for (_, pos) in captures.iter_pos().enumerate() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册