Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Regular-expressions/Rust/regular-expressions.rust
Normal file
11
Task/Regular-expressions/Rust/regular-expressions.rust
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
use regex::Regex;
|
||||
|
||||
fn main() {
|
||||
let s = "I am a string";
|
||||
|
||||
if Regex::new("string$").unwrap().is_match(s) {
|
||||
println!("Ends with string.");
|
||||
}
|
||||
|
||||
println!("{}", Regex::new(" a ").unwrap().replace(s, " another "));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue