Difference between revisions of "MSL by example"

From MSL-Libraries
Jump to navigationJump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Regular Expressions ==
+
* [[MSL by example:Regular Expressions|Regular Expressions]]
 
 
// Generic string matching
 
string regExpression = "^CLUSTAL W (\\S+)\\s+([\\S\\s]+)$";
 
string lineToMatch="CLUSTAL W 2.1 multiple sequence alignment";
 
 
vector<string> results;
 
 
// Line which should match RegEx
 
if (MslTools::regex(lineToMatch,regExpression,results)){
 
 
  cout << "PASS test 1\n";
 
 
  // Print out the matched '()' substrings
 
  for (uint i = 0; i < results.size();i++){
 
    cout << "Match["<<i<<"]: "<<results[i]<<endl;
 
  }
 
 
} else {
 
  cerr << "ERROR did not match line properly.\n";
 
}
 

Latest revision as of 16:02, 16 February 2010