Back to index

nordugrid-arc-nox  1.1.0~rc6
test_regex.cpp
Go to the documentation of this file.
00001 // -*- indent-tabs-mode: nil -*-
00002 
00003 #include <ArcRegex.h>
00004 #include <string>
00005 #include <list>
00006 #include <iostream>
00007 
00008 int main(void) {
00009   std::string str = "[@id=\"ahssgf0afhha0-adja-dkkda\"]";
00010   std::string r = "([a-zA-Z0-9_\\\\-]*)=\"([a-zA-Z0-9_\\\\-]*)\"";
00011   Arc::RegularExpression rx(r);
00012   if (rx.isOk()) {
00013     std::list<std::string> ump, mp;
00014     rx.match(str, ump, mp);
00015     std::list<std::string>::iterator it;
00016     for (it = mp.begin(); it != mp.end(); it++)
00017       std::cout << (*it) << std::endl;
00018   }
00019   else
00020     std::cout << "Invalid regexp" << std::endl;
00021   return 0;
00022 }