// 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)((?<="pressure".."pressure")[^"]+(?=")\"*[a-zA-Z]+"[,]\s+)(\d)[.](\d)(\d+)(,[^\d])(([-]\d+).(\d)(\d+)),[^\d]"#).unwrap();
let string = "\"0x03\": [
[\"Q1000 LPG\", \"P94_0_00\", 0, 0, \"0x30\",\"0x03\", 0, \"pressure\" ,\"pressure\", [], 0.0,0.0, 0.1, \"False\", 1.5618, 0.0, 0.0, 5.0, \"[10.0, None]\", \"Lps\"],
[\"P1000 LPG Tank\", \"P94_0_01\", 0, 1, \"0x30\",\"0x03\", 0, \"pressure\", \"pressure\", [], 0.0,0.0, 0.1, \"True\", 1.5633, -1.1520, 0.0, 5.0, \"[10.0, 'None']\", \"MPa\"],
[\"P1004 LPG Injector\", \"P94_0_02\", 0, 2, \"0x30\",\"0x03\", 0, \"pressure\" ,\"pressure\", [], 0.0,0.0, 0.1, \"True\", 3.1146, -2.3736, 0.0, 10.0, \"[10.0, 'None']\", \"MPa\"],
[\"P1006 Chamber\", \"P94_0_03\", 0, 3, \"0x30\",\"0x03\", 0, \"pressure\" ,\"pressure\", [], 0.0,0.0, 0.1, \"True\", 3.1317, -2.3863, 0.0, 10.0, \"[10.0, 'None']\", \"MPa\"],
[\"P1002 GOX Inlet\", \"P94_0_04\", 0, 4, \"0x30\",\"0x03\", 0, \"pressure\" ,\"pressure\", [], 0.0,0.0, 0.1, \"True\", 3.1276, -2.3934, 0.0, 10.0, \"[10.0, 'None']\", \"MPa\"],
[\"P1001 GOX Supply\", \"P94_0_05\", 0, 5, \"0x30\",\"0x03\", 0, \"pressure\" ,\"pressure\", [], 0.0,0.0, 0.1, \"True\", 1.5622, -1.1519, 0.0, 5.0, \"[10.0, None]\", \"MPa\"],
[\"P 06\", \"P94_0_06\", 0, 6, \"0x30\",\"0x03\", 0, \"pressure\" ,\"pressure\", [], 0.0,0.0, 0, \"False\", 1.5629, -1.1533, 0.0, 5.0, \"[10.0, None]\", \"MPa\"],
[\"P 07\", \"P94_0_07\", 0, 7, \"0x30\",\"0x03\", 0, \"pressure\" ,\"pressure\", [], 0.0,0.0, 0, \"False\", 1.5633, -1.1548, 0.0, 5.0, \"[10.0, None]\", \"MPa\"],
[\"P 08\", \"P94_0_08\", 0, 8, \"0x30\",\"0x03\", 0, \"pressure\" ,\"pressure\", [], 0.0,0.0, 0, \"False\", 1.5622, -1.1556, 0.0, 5.0, \"[10.0, None]\", \"MPa\"],
[\"P 09\", \"P94_0_09\", 0, 9, \"0x30\",\"0x03\", 0, \"pressure\" ,\"pressure\", [], 0.0,0.0, 0, \"False\", 1.5605, -1.142, 0.0, 5.0, \"[10.0, None]\", \"MPa\"],
[\"P 10\", \"P94_0_10\", 0, 10, \"0x30\",\"0x03\", 0,\"pressure\" ,\"pressure\", [], 0.0,0.0, 0, \"False\", 3.1326, -2.4067, 0.0, 5.0, \"[10.0, None]\", \"MPa\"],
[\"P 11\", \"P94_0_11\", 0, 11, \"0x30\",\"0x03\", 0,\"pressure\" ,\"pressure\", [], 0.0,0.0, 0, \"False\", 3.1354, -2.4408, 0.0, 5.0, \"[10.0, None]\", \"MPa\"],
[\"P 12\", \"P94_0_12\", 0, 12, \"0x30\",\"0x03\", 0,\"pressure\" ,\"pressure\", [], 0.0,0.0, 0, \"False\", 3.1354, -2.4408, 0.0, 5.0, \"[10.0, None]\", \"MPa\"],
[\"P 13\", \"P94_0_13\", 0, 13, \"0x30\",\"0x03\", 0,\"pressure\" ,\"pressure\", [], 0.0,0.0, 0, \"False\", 3.1354, -2.4408, 0.0, 5.0, \"[10.0, None]\", \"MPa\"],
[\"T 00\", \"M94_1_00\", 1, 0, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_00\"], 1.0,0.0, 0.2, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 01\", \"M94_1_01\", 1, 1, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_01\"], 1.0,0.0, 0.2, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 02\", \"M94_1_02\", 1, 2, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_02\"], 1.0,0.0, 0.2, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 03\", \"M94_1_03\", 1, 3, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_03\"], 1.0,0.0, 0.2, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 04\", \"M94_1_04\", 1, 4, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_04\"], 1.0,0.0, 0.2, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 05\", \"M94_1_05\", 1, 5, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_05\"], 1.0,0.0, 0.2, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 06\", \"M94_1_06\", 1, 6, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_06\"], 1.0,0.0, 0.2, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 07\", \"M94_1_07\", 1, 7, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_07\"], 1.0,0.0, 0.2, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 08\", \"M94_1_08\", 1, 8, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_08\"], 1.0,0.0, 0.2, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 09\", \"M94_1_09\", 1, 9, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_09\"], 1.0,0.0, 0.2, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 10\", \"M94_1_10\", 1, 10, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_10\"], 1.0,0.0, 0.2, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 11\", \"M94_1_11\", 1, 11, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_11\"], 1.0,0.0, 0.2, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 12\", \"M94_1_12\", 1, 12, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_12\"], 1.0,0.0, 0.2, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 13\", \"M94_1_13\", 1, 13, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_13\"], 1.0,0.0, 0.2, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 14\", \"M94_1_14\", 1, 14, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_14\"], 1.0,0.0, 0.2, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 15\", \"M94_1_15\", 1, 15, \"0x30\",\"0x03\", 1, \"temperature\" ,\"tempTypePT100_TypeA\", [\"M94_2_15\"], 1.0,0.0, 0, \"False\", 1.0, 0.0, 0.0, 373.15, \"[10.0, None]\", \"K\"],
[\"T 00 Comp\",\"M94_2_00\", 2, 0, \"0x30\",\"0x03\", 1, \"volt\" ,\"volt\", [], 1.0,0.0, 0, \"False\", 1.0, 0.0, 0.0, 5.0, \"[10.0, None]\", \"V\"],
[\"T 01 Comp\",\"M94_2_01\", 2, 1, \"0x30\",\"0x03\", 1, \"volt\" ,\"volt\", [], 1.0,0.0, 0, \"False\", 1.0, 0.0, 0.0, 5.0, \"[10.0, None]\", \"V\"],
[\"T 02 Comp\",\"M94_2_02\", 2, 2, \"0x30\",\"0x03\", 1, \"volt\" ,\"volt\", [], 1.0,0.0, 0, \"False\", 1.0, 0.0, 0.0, 5.0, \"[10.0, None]\", \"V\"],
[\"T 03 Comp\",\"M94_2_03\", 2, 3, \"0x30\",\"0x03\", 1, \"volt\" ,\"volt\", [], 1.0,0.0, 0, \"False\", 1.0, 0.0, 0.0, 5.0, \"[10.0, None]\", \"V\"],
[\"T 04 Comp\",\"M94_2_04\", 2, 4, \"0x30\",\"0x03\", 1, \"volt\" ,\"volt\", [], 1.0,0.0, 0, \"False\", 1.0, 0.0, 0.0, 5.0, \"[10.0, None]\", \"V\"],
[\"T 05 Comp\",\"M94_2_05\", 2, 5, \"0x30\",\"0x03\", 1, \"volt\" ,\"volt\", [], 1.0,0.0, 0, \"False\", 1.0, 0.0, 0.0, 5.0, \"[10.0, None]\", \"V\"],
[\"T 06 Comp\",\"M94_2_06\", 2, 6, \"0x30\",\"0x03\", 1, \"volt\" ,\"volt\", [], 1.0,0.0, 0, \"False\", 1.0, 0.0, 0.0, 5.0, \"[10.0, None]\", \"V\"],
[\"T 07 Comp\",\"M94_2_07\", 2, 7, \"0x30\",\"0x03\", 1, \"volt\" ,\"volt\", [], 1.0,0.0, 0, \"False\", 1.0, 0.0, 0.0, 5.0, \"[10.0, None]\", \"V\"],
[\"T 08 Comp\",\"M94_2_08\", 2, 8, \"0x30\",\"0x03\", 1, \"volt\" ,\"volt\", [], 1.0,0.0, 0, \"False\", 1.0, 0.0, 0.0, 5.0, \"[10.0, None]\", \"V\"],
[\"T 09 Comp\",\"M94_2_09\", 2, 9, \"0x30\",\"0x03\", 1, \"volt\" ,\"volt\", [], 1.0,0.0, 0, \"False\", 1.0, 0.0, 0.0, 5.0, \"[10.0, None]\", \"V\"],";
let substitution = "\\1\\2\\3.\\4\\5\\7\\8.\\9";
// 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/