Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUST

split text on multiple separators and put into a list

use regex::Regex; 

fn main() {
    // split text on multiple separators and put into a list
    let q = "The quick brown fox jumps over the lazy dog's back";
    let separator = Regex::new(r"([ ,.]+)").expect("Invalid regex");
    let words: Vec<_> = separator.split(q).into_iter().collect();
    println!("{:?}", words);
}
 
PREVIOUS NEXT
Tagged: #split #text #multiple #separators #put #list
ADD COMMENT
Topic
Name
4+3 =