Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F123398
RegEx.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Size
868 B
Referenced Files
None
Subscribers
None
RegEx.cpp
View Options
#include
<echo/Util/RegEx.h>
namespace
Echo
{
namespace
Utils
{
namespace
RegEx
{
void
ProcessRegExCaptureBool
(
const
std
::
string
&
content
,
const
std
::
string
&
expression
,
function
<
void
(
size_t
,
bool
)
>
functionToCall
)
{
if
(
!
functionToCall
)
{
return
;
}
boost
::
regex
regEx
(
expression
);
//Split up the line into function and parameters.
boost
::
cregex_iterator
it
(
&
content
[
0
],
&
content
[
content
.
length
()
-
1
],
regEx
);
boost
::
cregex_iterator
itEnd
;
size_t
matchCount
=
0
;
while
(
it
!=
itEnd
)
{
// (*it)[0] contains the whole string
// (*it)[1] contains the value
std
::
string
value
((
*
it
)[
1
].
first
,
(
*
it
)[
1
].
second
);
bool
isTrue
=
(
value
==
"yes"
)
||
(
value
==
"1"
)
||
(
value
==
"true"
);
functionToCall
(
matchCount
,
isTrue
);
matchCount
++
;
++
it
;
}
}
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Wed, Jan 15, 9:20 PM (3 h, 22 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
71934
Default Alt Text
RegEx.cpp (868 B)
Attached To
Mode
rEE Echo 3
Attached
Detach File
Event Timeline
Log In to Comment