Question: Check if input string entered by user is in format like IIPIII, where I is integer number, any one digit number can be used on place of I and P is a character. 
Example if input is 32P125 it is valid string else N23P33 is invalid.

I tried using `string.Length` or `string.IndexOf("P")` but how to validate other integer values?

Answer: 
Considering that 'P' has to matched literally -

```
      using System;
      using System.Text.RegularExpressions;

      public class Program
      {
        public static void Main()
        {
            string st1 = "32P125";
            string st2 = "N23P33";
            Regex rg = new Regex(@"\d{2}P\d{3}");
            // If 'P' is not to be matched literally, reeplace above line with below           one
            // Regex rg = new Regex(@"\d{2}[A-Za-z]\d{3}");
            Console.WriteLine(rg.IsMatch(st1));
            Console.WriteLine(rg.IsMatch(st2));
        }
      }

```

OUTPUT

`True`  

`False`
Use simple [Regular expression](//regexone.com/references/csharp) for this kind of stuff.