[Mono-dev] Mono Regex not working the same as MS .NET

Adar Wesley adar.wesley at gmail.com
Sun Jul 26 15:10:03 EDT 2009


Hi,

I would suspect the \r\n part of the pattern.  On UNIX systems new line does
not include the \r.

---
Adar Wesley


On Sun, Jul 26, 2009 at 7:57 PM, Alan McGovern <alan.mcgovern at gmail.com>wrote:

> Hey,
>
> Could you take that testcase and info a file a bug report on
> bugzilla.novell.com
>  . This way the isse won't be forgotten about and will be dealt with
> properly.
>
> Alan.
>
> On 26 Jul 2009, at 17:50, St4rNin3 <st4rnin3 at gmail.com> wrote:
>
> >
> > I am having some issues with Regex processing.  It seems that the
> > Mono engine
> > and the .NET engine get different results.
> >
> > The code below works just fine on my Windows PC, but gets no matches
> > on my
> > Linux System.
> >
> > I am using Mandriva 2009 Spring, with the 2.2 version of Mono.  I
> > have not
> > downloaded the latest 2.4 release. I was trying not to have to
> > manually
> > install on Mandriva (2.2 is the latest in their package system)
> >
> >
> > I have taken a snippet of code (with some hard coded data) for
> > demonstration
> > purposes.
> > =========================================
> >            string sData =
> > @"-
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > ---
> > --------------------------------------------------------------------
> > 001-00000151 :LastNameHolder;FirstnameHolder :Address Holder";
> >
> >            string sPattern;
> >            sPattern = @"---+\r\n(?<AccountNumber>\d{3}-\d{8}).*?";
> >
> >
> >
> >            MatchCollection mc;
> >            mc = Regex.Matches(sData, sPattern,
> > RegexOptions.IgnoreCase |
> > RegexOptions.Singleline);
> >            label1.Text = string.Format("{0} matches found", mc.Count);
> >
> > ========================================
> > Any Ideas?
> >
> > Dan Gentry
> >
> > --
> > View this message in context:
> http://www.nabble.com/Mono-Regex-not-working-the-same-as-MS-.NET-tp24629584p24629584.html
> > Sent from the Mono - Dev mailing list archive at Nabble.com.
> >
> > _______________________________________________
> > Mono-devel-list mailing list
> > Mono-devel-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-devel-list
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090726/ed8b2f25/attachment.html 


More information about the Mono-devel-list mailing list