Regex.pm
package MixPerl::Regex;
use strict;
use namespace "System";
use PerlNET qw(AUTOCALL);
#Constructor
=for interface
[interface: pure]
static Regex();
=cut
#Methods
=for interface
static string Replace(str SourceString, str FindPattern, str ReplacePattern);
static string Replaceg(str SourceString, str FindPattern, str ReplacePattern);
static string Replacegi(str SourceString, str FindPattern, str ReplacePattern);
=cut
#Constructor
sub new
{
my $class = shift;
my $self = bless {}, $class;
return $self;
}
#Methods
sub Replace
{
my ($source, $find, $replace) = @_;
$source =~ s/$find/$replace/;
return $source;
}
sub Replaceg
{
my ($source, $find, $replace) = @_;
$source =~ s/$find/$replace/g;
return $source;
}
sub Replacegi
{
my ($source, $find, $replace) = @_;
$source =~ s/$find/$replace/gi;
return $source;
}
Program.cs
using System;
namespace TestConsole
{
class Program
{
static void Main(string[] args)
{
string line;
line = MixPerl.Regex.Replaceg("abcB", "b", "x");
Console.WriteLine(line);
line = MixPerl.Regex.Replacegi("abcB", "b", "x");
Console.WriteLine(line);
}
}
}
'Code > Study' 카테고리의 다른 글
| [AutoHotkey] SetTimer & PostMessage (0) | 2010.04.18 |
|---|---|
| [Perl] Cocoa (pl pm sample) (0) | 2008.11.09 |
| [PerlNET] CIty (Mix Perl & C#) (0) | 2008.11.09 |
| [Perl] BeeConverter (Convert HTML Entity to Unicode Character) (0) | 2008.11.09 |
| [C/C++ vs C#] static (1) (0) | 2008.07.16 |
Perl_Regex.zip