c# - A Regular Expression Which matches the sequence -


The set of strings can be like these.

1) Any type of indicator & lt; Anycharacter & gt; Any kind of non-informants of any type of person

2) For any person & lt; Anychar & gt; anyNoOfcharacters and as a (final String) '#'

3) anyNoOfcharacters "_" anyNoOfcharacters and after a "#"

4) anyNoOfcharacters and anyNoOfdigits a "#"

Can there be a single regex which can validate all the above set of stars?

This I have done ...

  RegEx patterns = new Regex (@ "^ [A-GAA-Z 0-9 \ _] + [A- GA-Z0-9 # .-] | [\ બી \ w \ D] | ");   

According to your needs, here is a regex that you must match one of the five accurate stars listed. If it does not mean that you have, please clarify

  Regex pattern = new Regex (@ "(Ads & lt; R & gt ;. _aimDate50ms \ Okay) | (ads K & lt; t & gt; Valid #) | (tactics_priorityT) | (tactics_SelectedADS #) | (ads3bValid #) ");   

Edit

Waves your needs too much, let's try to define some specific rules. I think we might want:

  • one or more characters, then
  • zero or more letters or numbers or underscores, then
    • One or more More than one letter, a #
    • exactly a character, followed by
    • exactly one letter, after zero or more letters or numbers or underscores,
    • exactly a & gt; character, after this
    • One or more letters or numbers or underscores or . character, followed by
    • zero or one # character

      Is it in ballpark? These rules match your examples, yet they still can not be "right" What I mean when I say that you should be specific. If you can explicitly describe what the pattern is, you can write a regex for it. If you can not understand a set of rules to describe the pattern, then there is no way to convert it to a regedge.

      Can you update your question to list specific rules of the pattern right now? For each part of the pattern we need to know: what type of character or characters are you looking forward to, and how many of them can appear in the line, for example, zero or more, one or more, absolutely one , e.t.c.

      Edit

      Based on your updated question, I think I have a view. When you say "the person of any person", then you did not clarify what kind of characters, but if you really mean any kind of character, which includes empty spaces, punctuation marks, then again is not very useful Because it will be about everything. So I am going to think that in that case only you tell the letters.

      1. [e-za-za] * lt .; & Gt;

        Here are your rules (with my assumption about "any abuser"), translated into regex:

        1. ; [E-za-jade] *. [E-za-z] *
        2. [AZA-Z] *
        3. [A-Za-z] * _ [A-Za-z] * # < Li> To get the code in a single Regex, you can add the word by entering the code ( ) around each rule and between a | Adding is like this:
            Regex Pattern = New Regex (@ "([AZAZ] *   

          I'm feeling that this is close, but still this probably is not enough. Do you have enough, where you can take it and refine it for your needs? If not, please make it more clear.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -