Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Regex C++
SUBMITTED BY:
Guest
DATE:
May 3, 2013, 5:57 p.m.
FORMAT:
C++
SIZE:
778 Bytes
Raw
Download
Tweet
HITS:
1144
Go to comments
Report
#include
<iostream>
#include
<regex>
#include
<string>
int
main
()
{
std
::
vector
<
std
::
string
>
str
;
std
::
vector
<
std
::
string
>
list
;
std
::
string
tmp
;
do
{
std
::
cin
>>
tmp
;
list
.
push_back
(
tmp
);
}
while
(
tmp
!=
"END"
);
do
{
std
::
cin
>>
tmp
;
str
.
push_back
(
tmp
);
}
while
(
tmp
!=
"END"
);
for
(
auto
&
it
:
list
)
{
std
::
cout
<<
"Regex: "
<<
it
<<
std
::
endl
;
for
(
int
i
=
0
;
i
<
str
.
size
();
++
i
)
{
std
::
regex
pattern
(
it
,
std
::
regex_constants
::
basic
);
std
::
cout
<<
std
::
regex_match
(
str
[
i
],
pattern
)
<<
std
::
endl
;
}
}
return
0
;
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus