System.Text.Regex Parameters

Nuva Language

System.Text.Regex Parameters


wasuplee123 07-21-2008, 3:17 PM
The API shows the following:

regexVar = System.Text.Regex(pattern, options)

I figured out that pattern is a string variable, but what type is options, and what values can it take?


--

Also it would help if the API had type prefixes for function arguments as well...

For Example, these 2 functions:

matchVar = regexVar.Match(theInput)
strVar = strVar.Left(Count)

should be written as:

matchVar = regexVar.Match(strTheInput)
strVar = strVar.Left(intCount)


This would help clarify what argument types the functions take.

Re: System.Text.Regex Parameters


Bill 07-22-2008, 1:38 AM
The help file is updated accroding to your suggestion, thanks.

// example for System.Text.Regex
// regex options is a string, it can contain options:
//   s: single line
//   m: multiple line
//   i: case insensitive
//   x: ignore white space in pattern

var regex = system.text.regex(pattern, 'si');
var match = regex.match(strInput);
var output = '';

while match.success do
 
  output ~= match.unmatchedValue;
 
  //var matchedValue = match.value;
  var id = match.groupByName('id').value;

  ... ...

  match.nextMatch();
end while

output ~= match.unmatchedValue();

// end example

Powered by Community Server, by Telligent Systems