// include the latest version of the regex crate in your Cargo.toml
extern crate regex;
use regex::Regex;
fn main() {
let regex = Regex::new(r"(?m)^(?!\[HMR\]).*$").unwrap();
let string = "[WDS] App hot update...
[HMR] Checking for updates on the server...
[HMR] Updated modules:
[HMR] - ./src/$$_lazy_route_resource lazy recursive
[HMR] - ./node_modules/@angular/core/fesm5/core.js
[HMR] - ./src/hmr.ts
[HMR] - ./src/app/app.module.ts
[HMR] - ./src/app/shared/guards/auth.guard.ts
[HMR] - ./node_modules/@angular/router/fesm5/router.js
[HMR] - ./node_modules/@angular/common/fesm5/common.js
[HMR] - ./node_modules/@angular/platform-browser/fesm5/platform-browser.js
[HMR] - ./src/app/shared/services/jwt.service.ts
[HMR] - ./node_modules/@angular/common/fesm5/http.js
[HMR] - ./src/app/shared/guards/role.guard.ts
[HMR] - ./node_modules/@ngx-progressbar/core/fesm5/ngx-progressbar-core.js
[HMR] - ./node_modules/@auth0/angular-jwt/index.js
[HMR] - ./node_modules/@auth0/angular-jwt/src/jwt.interceptor.js
[HMR] - ./node_modules/@auth0/angular-jwt/src/jwthelper.service.js
[HMR] - ./node_modules/@auth0/angular-jwt/src/jwtoptions.token.js
[HMR] - ./src/app/shared/modules/layout/layout.module.ts
[HMR] - ./src/app/shared/modules/clock/clock.module.ts
[HMR] - ./src/app/shared/modules/clock/clock.component.ts
[HMR] - ./src/app/shared/modules/layout/layout.routing.ts
[HMR] - ./src/app/shared/modules/layout/account/account.page.ts
[HMR] - ./src/app/shared/modules/layout/default/default.page.ts
[HMR] - ./src/app/shared/modules/layout/default/sidebar-menu/sidebar-menu.component.ts
[HMR] - ./src/app/shared/modules/layout/default/header/header.component.t
sdfadsfas asdf asdfasd fasdf asdfasdf asd fa sd fasdfasf asdf asdfasdfas dfasd df";
// result will be an iterator over tuples containing the start and end indices for each match in the string
let result = regex.captures_iter(string);
for mat in result {
println!("{:?}", mat);
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Rust, please visit: https://docs.rs/regex/latest/regex/