mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
27 lines
612 B
C++
27 lines
612 B
C++
#include <plugin/pcre/Pcre.h>
|
|
|
|
using namespace Upp;
|
|
|
|
CONSOLE_APP_MAIN
|
|
{
|
|
RegExp r0("(\\w+)\\s(\\w+)\\s(\\w+)");
|
|
if(r0.Match("one two three"))
|
|
{
|
|
for(int i = 0; i < r0.GetCount(); i++)
|
|
Cout() << r0[i] << '\n';
|
|
Cout() << "---\n";
|
|
} else if(r0.IsError())
|
|
Cout() << r0.GetError() << '\n';
|
|
|
|
Cout() << "------------------------------\n";
|
|
|
|
RegExp r1("(\\w+)", RegExp::UNICODE);
|
|
int i = 0;
|
|
while(r1.GlobalMatch("hello 4 ho 55 uuu iii pp 99 baby too swistak"))
|
|
{
|
|
for(int i = 0; i < r1.GetCount(); i++)
|
|
Cout() << r1[i] << '\n';
|
|
}
|
|
if(r1.IsError())
|
|
Cout() << r1.GetError() << '\n';
|
|
}
|