// 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"(?s)(?=\[([-0-9\s:]+)\]\s(\w+)\.(\w+):\s(.+))").unwrap();
let string = "[2021-11-20 01:31:44] prodaction.INFO: Был обновлен статус аренды. (PB GetRental) Данные: {\"id\":2845,\"rental_id\":\"8f93a037-431b-4a64-b211-5be91689cea9\",\"reservation_id\":\"\",\"country_id\":19,\"user_id\":1644445545,\"number\":\"9105383799\",\"cost\":4,\"price\":8,\"free_quota\":15,\"timeRemaining\":\"91:10:10\",\"expiration\":\"2021-11-23T12:41:55.550771-05:00\",\"maxRentalLifetime\":\"2021-11-23T12:41:54.665765-05:00\",\"autoRenew\":0,\"emailReminder\":true,\"status\":\"Rented\",\"targets\":[{\"name\":\"PNC Bank\",\"price\":\"8\",\"subId\":\"70e0dd4a-be1c-49f3-bd59-a8ffe412a804\",\"number\":\"9105383799\",\"targetId\":10205,\"renewalPrice\":{\"amount\":4,\"currency\":{\"code\":\"USD\",\"name\":\"Dollar\",\"symbol\":\"$\",\"abbreviation\":\"USD\",\"stringFormat\":\"{0:#0.00}\"}},\"dailyFreeQuota\":15}],\"isNew\":null,\"provider\":\"PB\",\"created_at\":\"2021-11-16 20:42\",\"updated_at\":\"2021-11-20 01:31:44\",\"autoRenew_bot\":0}
[2021-11-20 01:31:44] prodaction.INFO: App\\Api\\PhoneBlur::getRentalActivity | Получен ответ: [
{
\"lineNumber\": \"9105383799\",
\"lineType\": \"Temporary Rental\",
\"subscriptionItemId\": \"70e0dd4a-be1c-49f3-bd59-a8ffe412a804\",
\"payloadDisplayValue\": \"951500\",
\"fullPayloadValue\": \"PNC Bank \\nYour passcode is 951500.\\nDon't share it with anyone. We also won't call and ask for it. If you didn't request this passcode, call us at 1-800-762-2035\",
\"isAssignedToSlice\": true,
\"target\": {
\"name\": \"PNC Bank\",
\"searchKeywords\": \"PNCBank pnc bank\",
\"description\": null,
\"iconUri\": \"/static/images/targets/icons/pncbank.png\",
\"targetId\": 10205
},
\"sentAt\": \"2021-11-19T17:31:07.153391-05:00\",
\"sentFrom\": \"32858\",
\"totalRecords\": 0,
\"unfilteredSmsSendingAddOnId\": null,
\"hasUnfilteredSmsSendingAddOn\": false
},
{
\"lineNumber\": \"9105383799\",
\"lineType\": \"Temporary Rental\",
\"subscriptionItemId\": \"70e0dd4a-be1c-49f3-bd59-a8ffe412a804\",
\"payloadDisplayValue\": \"435061\",
\"fullPayloadValue\": \"PNC Bank \\nYour passcode is 435061.\\nDon't share it with anyone. We also won't call and ask for it. If you didn't request this passcode, call us at 1-800-762-2035\",
\"isAssignedToSlice\": true,
\"target\": {
\"name\": \"PNC Bank\",
\"searchKeywords\": \"PNCBank pnc bank\",
\"description\": null,
\"iconUri\": \"/static/images/targets/icons/pncbank.png\",
\"targetId\": 10205
},
\"sentAt\": \"2021-11-18T08:58:33.486598-05:00\",
\"sentFrom\": \"32858\",
\"totalRecords\": 0,
\"unfilteredSmsSendingAddOnId\": null,
\"hasUnfilteredSmsSendingAddOn\": false
},
{
\"lineNumber\": \"9105383799\",
\"lineType\": \"Temporary Rental\",
\"subscriptionItemId\": \"70e0dd4a-be1c-49f3-bd59-a8ffe412a804\",
\"payloadDisplayValue\": \"553777\",
\"fullPayloadValue\": \"PNC Bank \\nYour passcode is 553777.\\nDon't share it with anyone. We also won't call and ask for it. If you didn't request this passcode, call us at 1-800-762-2035\",
\"isAssignedToSlice\": true,
\"target\": {
\"name\": \"PNC Bank\",
\"searchKeywords\": \"PNCBank pnc bank\",
\"description\": null,
\"iconUri\": \"/static/images/targets/icons/pncbank.png\",
\"targetId\": 10205
},
\"sentAt\": \"2021-11-16T13:42:11.646616-05:00\",
\"sentFrom\": \"32858\",
\"totalRecords\": 0,
\"unfilteredSmsSendingAddOnId\": null,
\"hasUnfilteredSmsSendingAddOn\": false
},
{
\"lineNumber\": \"9105383799\",
\"lineType\": \"Temporary Rental\",
\"subscriptionItemId\": \"70e0dd4a-be1c-49f3-bd59-a8ffe412a804\",
\"payloadDisplayValue\": \"676482\",
\"fullPayloadValue\": \"PNC Bank\\nYour passcode is 676482.\\nDon't share it with anyone. We also won't call and ask for it. If you didn't request this passcode, call us at 1-800-762-2035\",
\"isAssignedToSlice\": true,
\"target\": {
\"name\": \"PNC Bank\",
\"searchKeywords\": \"PNCBank pnc bank\",
\"description\": null,
\"iconUri\": \"/static/images/targets/icons/pncbank.png\",
\"targetId\": 10205
},
\"sentAt\": \"2021-11-16T12:59:29.093793-05:00\",
\"sentFrom\": \"76200\",
\"totalRecords\": 0,
\"unfilteredSmsSendingAddOnId\": null,
\"hasUnfilteredSmsSendingAddOn\": false
},
{
\"lineNumber\": \"9105383799\",
\"lineType\": \"Temporary Rental\",
\"subscriptionItemId\": \"70e0dd4a-be1c-49f3-bd59-a8ffe412a804\",
\"payloadDisplayValue\": \"3345572\",
\"fullPayloadValue\": \"PNC Text Banking\\nYour verification code is 3345572. Please enter this code on the web site to complete the verification.\\nReply HELP for help\",
\"isAssignedToSlice\": true,
\"target\": {
\"name\": \"PNC Bank\",
\"searchKeywords\": \"PNCBank pnc bank\",
\"description\": null,
\"iconUri\": \"/static/images/targets/icons/pncbank.png\",
\"targetId\": 10205
},
\"sentAt\": \"2021-11-16T12:43:39.379496-05:00\",
\"sentFrom\": \"762265\",
\"totalRecords\": 0,
\"unfilteredSmsSendingAddOnId\": null,
\"hasUnfilteredSmsSendingAddOn\": false
}
]Код: 200HEADERS: {\"url\":\"https:\\/\\/www.phoneblur.com\\/api\\/incoming-temporary-rental-text-messages\\/8f93a037-431b-4a64-b211-5be91689cea9\",\"content_type\":\"application\\/json; charset=utf-8\",\"http_code\":200,\"header_size\":760,\"request_size\":732,\"filetime\":-1,\"ssl_verify_result\":0,\"redirect_count\":0,\"total_time\":0.225958,\"namelookup_time\":4.7e-5,\"connect_time\":0.016106,\"pretransfer_time\":0.059616,\"size_upload\":0,\"size_download\":3918,\"speed_download\":17413,\"speed_upload\":0,\"download_content_length\":-1,\"upload_content_length\":-1,\"starttransfer_time\":0.22572,\"redirect_time\":0,\"redirect_url\":\"\",\"primary_ip\":\"172.67.223.241\",\"certinfo\":[],\"primary_port\":443,\"local_ip\":\"185.250.205.40\",\"local_port\":50942,\"http_version\":2,\"protocol\":2,\"ssl_verifyresult\":0,\"scheme\":\"HTTPS\"}
[2021-11-20 01:42:17] prodaction.INFO: Пользователь пере заказал номер 1807c155-0b8b-4ff3-a042-0a8aa3313e15 по цене 0.1 USD. Пользователю 1966343459 Были сняты средства в размере 0.1 USD.";
// 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/