// 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)^([ \t]*)import [*] as (\w+) from (?:(['])((?:(?:\.)+|[^\n\r'\\]+)+)[']|(["])((?:(?:\.)+|[^\n\r'\\]+)+)["])"#).unwrap();
let string = "import * as Atblock from \"./atblock\"
import * as Atrule from \"./atrule\"
import * as Supports from \"./supports\"
import * as Node from './node';
import * as Root from './root'
import Null from './null'
import * as Each from './each'
import * as If from './if'
import * as Call from './call'
import * as UnaryOp from './unaryop'
import * as BinOp from './binop'
import * as Ternary from './ternary'
import * as Block from './block'
import * as Unit from './unit'
import * as String from './string'
import * as HSLA from './hsla'
import * as RGBA from './rgba'
import * as Ident from './ident'
import * as Group from './group'
import * as Literal from './literal'
import * as Boolean from './boolean'
import * as Return from './return'
import * as Media from './media'
import * as QueryList from './query-list'
import * as Query from './query'
import * as Feature from './feature'
import * as Params from './params'
import * as Comment from './comment'
import * as Keyframes from './keyframes'
import * as Member from './member'
import * as Charset from './charset'
import * as Namespace from './namespace'
import * as Import from './import'
import * as Extend from './extend'
import * as Object from './object'
import * as Function from './function'
import * as Property from './property'
import * as Selector from './selector'
import * as Expression from './expression'
import * as Arguments from './arguments'
import * as Atblock from './atblock'
import * as Atrule from './atrule'
import * as Supports from './supports'
";
let substitution = "$1import $2 from $3$5$6$4$3$5";
// result will be a String with the substituted value
let result = regex.replace_all(string, substitution);
println!("{}", result);
}
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/