Skip to content

Regular Expressions

Regular Expressions discussions

This category can be followed from the open social web via the handle regular-expressions@forum.codeproject.com

188 Topics 829 Posts
  • 0 Votes
    2 Posts
    8 Views
    C
    Not exactly sure how it is in DataAnnotations, but the regexp would be: ^[^"]*("[^"]*")*[^"]*$ If you have further character limitations, you could put them in instead of just [^"]
  • html tag finder

    html regex
    6
    0 Votes
    6 Posts
    18 Views
    H
    You could have my TIP[^] to be useful. Regards, Hiren. My Recent Article: - Way to know which control have raised PostBack My Recent Tip/Trick: - Remove HTML Tag, get plain Text
  • xml regex (for php)

    php html regex xml question
    3
    0 Votes
    3 Posts
    9 Views
    F
    Thanks for the detailed explanation. After a more extensive searching I found out how to use xml_parser for blogspot feed. It certainly seems easier than regex.
  • As black as night.

    question
    6
    0 Votes
    6 Posts
    17 Views
    R
    Luc Pattyn wrote: expressive regulars Nice... :-D Will Rogers never met me.
  • Expression needed

    regex question help
    3
    0 Votes
    3 Posts
    9 Views
    OriginalGriffO
    It's not the best in the world, but it does the job: // using System.Text.RegularExpressions; /// /// Regular expression built for C# on: Mon, Sep 6, 2010, 12:26:15 PM /// Using Expresso Version: 3.0.3634, http://www.ultrapico.com /// /// A description of the regular expression: /// /// <% /// <% /// Any character that is NOT in this class: [\"], any number of repetitions /// " /// [InQuotes]: A named capture group. [.*] /// Any character, any number of repetitions /// Match a suffix but exclude it from the capture. [\"] /// Literal " /// Any character that is NOT in this class: [%], any number of repetitions /// %> /// %> /// /// /// public static Regex regex = new Regex( "<%[^\\\"]*\"(?.*)(?=\\\")[^%]*%>", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled ); // This is the replacement string public static string regexReplace = ""; //// Replace the matched text in the InputText using the replacement pattern // string result = regex.Replace(InputText,regexReplace); //// Split the InputText wherever the regex matches // string[] results = regex.Split(InputText); //// Capture the first Match, if any, in the InputText // Match m = regex.Match(InputText); //// Capture all Matches in the InputText // MatchCollection ms = regex.Matches(InputText); //// Test to see if there is a match in the InputText // bool IsMatch = regex.IsMatch(InputText); //// Get the names of all the named and numbered capture groups // string[] GroupNames = regex.GetGroupNames(); //// Get the numbers of all the named and numbered capture groups // int[] GroupNumbers = regex.GetGroupNumbers(); Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
  • Even Expresso couldn't help me with this RegEx - Can You?

    help regex question
    9
    0 Votes
    9 Posts
    29 Views
    A
    Making tools to help with regular expressions must be fun, because I made one too. Looks kinda like yours. :) [Forum Guidelines]
  • Differences between matches with same RegEx [modified]

    regex csharp c++ com sysadmin
    3
    0 Votes
    3 Posts
    10 Views
    R
    By jove I think he's got it! Good work fella...thanks a lot! C# has already designed away most of the tedium of C++.
  • another one

    php com beta-testing question code-review
    7
    0 Votes
    7 Posts
    22 Views
    A
    PIEBALDconsult wrote: tin whistles are made of tin I can another pattern here. ;P The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it. My latest tip/trick - Silverlight *.XCP files. Visit the Hindi forum here.