Skip to content
Discussion options

You must be logged in to vote

Solution:

    let re = Regex::new(&regex_key,
        glib::RegexCompileFlags::MULTILINE, glib::RegexMatchFlags::DEFAULT)
        .expect("Can't create Regex").expect("Can't create Regex");
    let g_dict_body = glib::GString::from_string_unchecked(dict_body.into());
    let words = re.match_(g_dict_body.as_gstr(),
        glib::RegexMatchFlags::DEFAULT).expect("Can't get MatchInfo");
    while words.matches(){
        let word = words.fetch(0).expect("Can't get word");
        let (word_start, word_end) = 
            words.fetch_pos(0).expect("Can't get word start and end.");
        println!("word: {}, word start: {}, word end: {}",
            word, word_start, word_end);
        let …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Wanpaku
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant