Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf6c1188

Browse files
committed
std.cpp
1 parentb300dfb commitf6c1188

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

‎CMakeLists.txt‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
cmake_minimum_required(VERSION 3.14)
2+
project("Regular Expressions" LANGUAGES CXX)
3+
4+
set_property(GLOBAL PROPERTYUSE_FOLDERSON)
5+
6+
add_executable(std std.cpp)
7+
8+
target_compile_features(stdPUBLIC cxx_std_17)
9+
10+
set_target_properties(std PROPERTIES CXX_EXTENSIONSOFF)

‎std.cpp‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include<iostream>
2+
#include<regex>
3+
#include<string>
4+
#include<vector>
5+
6+
intmain()
7+
{
8+
std::vector<std::string> lines{
9+
"[05821BE4 | 2019-05-13 12:28:56] (13036) http://contiview.site/projects/cmd.php [co_project.view] RQST START",
10+
"[05821BE4 | 2019-05-13 12:28:56] (13036) http://contiview.site/projects/cmd.php [co_project.view] RQST END [normal] 402 ms",
11+
"[05671FA1 | 2019-04-17 14:08:03] (62931) http://contiview.site/projects/cmd.php [co_project.view] RQST START",
12+
"[05671FA1 | 2019-04-17 14:08:03] (62931) http://contiview.site/projects/cmd.php [co_project.view] RQST END [normal] 237 ms",
13+
"[05822AE4 | 2019-06-17 06:59:03] (15828) http://contiview.site/cmd.php [co_project.dialog_doc_details] RQST START",
14+
"[05822AE4 | 2019-06-17 06:59:03] (15828) http://contiview.site/cmd.php [co_project.dialog_doc_details] RQST END [normal] 318 ms",
15+
"[00180D0F | 2009-09-15 09:34:47] (193.98.108.243:39170, 879) /cmd.php [co_search.browse] RQST START",
16+
"[00180D0F | 2009-09-15 09:34:48] (193.98.108.243:39170, 879) /cmd.php [co_search.browse] RQST END [normal] 799 ms",
17+
"[00180D0D | 2009-09-15 09:34:19] (193.98.108.243:39169, 23727) /browse/ RQST START",
18+
"[00180D0D | 2009-09-15 09:34:19] (193.98.108.243:39169, 23727) /browse/ RQST END [normal] 35 ms",
19+
"[001F86EA | 2009-11-02 16:05:50] (193.98.108.243:1789, 10994) /cmd.php [co_doc.details] RQST START",
20+
"[001F86EA | 2009-11-02 16:05:50] (193.98.108.243:1789, 10994) /cmd.php [co_doc.details] RQST END [normal] 84 ms"};
21+
22+
std::regex re{R"(\[([^ ]{8}) \| ([^\]]{19})\] \((?:[^,]+, )?\d+\) [^ ]+ \[([^\]]+)\] RQST END \[[^\]]+\] *(\d+) ms)"};
23+
std::smatch m;
24+
25+
for (auto line : lines)
26+
if (std::regex_match(line, m, re))
27+
if (m.size() >1)
28+
for (int i =1; i < m.size(); ++i)
29+
std::cout <<"MATCH" << i <<":\"" << m[i] <<"\"" << std::endl;
30+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp