Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1016209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:30:55+00:00 2026-05-16T10:30:55+00:00

How do I use the inline modifiers instead of RegexOptions.Option ? For example: Regex

  • 0

How do I use the inline modifiers instead of RegexOptions.Option?

For example:

Regex MyRegex = new Regex(@"[a-z]+", RegexOptions.IgnoreCase);

How do I rewrite this using the inline character i?

http://msdn.microsoft.com/en-us/library/yd1hzczs.aspx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:30:56+00:00Added an answer on May 16, 2026 at 10:30 am

    You can use inline modifiers as follows:

    // case insensitive match
    Regex MyRegex = new Regex(@"(?i)[a-z]+");  // case insensitive match
    

    or, inverse the meaning of the modifier by adding a minus-sign:

    // case sensitive match
    Regex MyRegex = new Regex(@"(?-i)[a-z]+");  // case sensitive match
    

    or, switch them on and off:

    // case sensitive, then case-insensitive match
    Regex MyRegex = new Regex(@"(?-i)[a-z]+(?i)[k-n]+");
    

    Alternatively, you can use the mode-modifier span syntax using a colon : and a grouping parenthesis, which scopes the modifier to only that group:

    // case sensitive, then case-insensitive match
    Regex MyRegex = new Regex(@"(?-i:[a-z]+)(?i:[k-n]+)");
    

    You can use multiple modifiers in one go like this (?is-m:text), or after another, if you find that clearer (?i)(?s)(?-m)text (I don’t). When you use the on/off switching syntax, be aware that the modifier works till the next switch, or the end of the regex. Conversely, using the mode-modified spans, after the span the default behavior will apply.

    Finally: the allowed modifiers in .NET are (use a minus to invert the mode):

    x allow whitespace and comments
    s single-line mode
    m multi-line mode
    i case insensitivity
    n only allow explicit capture (.NET specific)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 539k
  • Answers 539k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Ok. I found an answer: http://www.cs.cmu.edu/~me/212/environment.html When SML/NJ prints a… May 17, 2026 at 2:19 am
  • Editorial Team
    Editorial Team added an answer Templates for Analysis Services, Integration Services, and Reporting Services projects… May 17, 2026 at 2:19 am
  • Editorial Team
    Editorial Team added an answer That's the entity code for a ampersand - which is… May 17, 2026 at 2:19 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I use a PHP script to validate video requests before serving them. This script
If I create a dll called xaisoft.dll like this: Using System; Using System.Reflection; [assembly:AssemblyVersion(1.0.0.0)]
I'm currently stuck setting borders in an html table. (I use inline styles for
Due to MSVC10 not allowing the use of inline ASM instructions when targeting x64
Is it worth it to use the inline keyword or the compiler is smart
Recently there have been a couple questions regarding static type constraints and inline: Use
Using VS2008 and ASP.NET 3.5 (or VS 2010 / .NET 4.0?), how can I
I'm using Colorbox to show the html content of hidden divs on my page.
I have been trying to display image from database using php but i am
I'm trying to write a simple device driver for Windows 7 x64 using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.