case INsensitive regular expressions

Discussion in 'Perl Misc' started by sabinosa, Oct 21, 2004.

  1. sabinosa

    sabinosa Guest

    Hi everyone,
    I am working with a RegularExpressionValidator in Visual Studio.NET.
    I would like to define a custom regular expression that ignores the
    letter case and therefore is case INsensitive. I have seen that the
    syntax might be something like "(?i)" or "/i". However, when I try to
    use that as part of my regular expression (ex. (?i)^(CSV|ZIP|TXT)$)
    the result is a javascript error. The error says: "Syntax error in
    regular expression"
    (^(CSV|ZIP|TXT)$/i does not work)

    Any idea what I am doing wrong? Thanks in advance for your responses!
     
    sabinosa, Oct 21, 2004
    #1
    1. Advertising

  2. [ Followups set ]


    sabinosa <> wrote:

    > I am working with a RegularExpressionValidator in Visual Studio.NET.


    > Any idea what I am doing wrong?



    Posting a question that is not related to Perl into the Perl newsgroup.


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Oct 21, 2004
    #2
    1. Advertising

  3. sabinosa

    Matt Garrish Guest

    "J├╝rgen Exner" <> wrote in message
    news:nT1ed.12744$n81.3370@trnddc08...
    > sabinosa wrote:
    >> I am working with a RegularExpressionValidator in Visual Studio.NET.

    >
    > Interesting! I didn't know that Visual Studio.NET supports Perl. I guess
    > there is always something new to learn.
    >


    It's not nearly as impressive as it might sound. I would go with C# if you
    have to go the MS application/aspx route (although I only used the Perl
    extension for a while under the trial license). The only advantage I've
    found to .Net is that it makes other languages more Perlish (although still
    in a cramped and painful way), but it just gets in the way of Perl (i.e.,
    why go through all the building, matching and capturing involved in using
    the RegularExpressions class when Perl makes it so ridiculously easy). If
    you really need Perl in an ASPX environment, though, I guess there's no
    other option...

    >
    >> The error says: "Syntax error in
    >> regular expression"
    >> (^(CSV|ZIP|TXT)$/i does not work)

    >
    > At least the trailing /i is the correct syntax.


    In Perl, yes. In .Net, probably not. .Net has an ugly, verbose way of OR'ing
    modifiers. For example:

    Regex myPattern = new Regex(@"^(CSV|ZIP|TXT)$", RegexOptions.Multiline |
    RegexOptions.IgnoreCase);

    But then again, this is really getting off-topic for this group...

    Matt
     
    Matt Garrish, Oct 22, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tee
    Replies:
    3
    Views:
    7,858
    Herfried K. Wagner [MVP]
    Jun 23, 2004
  2. Replies:
    1
    Views:
    2,505
    Mark P
    Apr 6, 2007
  3. sabinosa

    case INsensitive regular expressions

    sabinosa, Oct 21, 2004, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    379
    Vijai Kalyan
    Oct 22, 2004
  4. Xah Lee
    Replies:
    4
    Views:
    1,004
  5. Noman Shapiro
    Replies:
    0
    Views:
    239
    Noman Shapiro
    Jul 17, 2013
Loading...

Share This Page