Question: using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.IO; using System.Text.RegularExpressions; namespace re { class Program { public static void
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.IO; using System.Text.RegularExpressions;
namespace re { class Program { public static void rgex(string input, string pattern) { Regex rg = new Regex(pattern); MatchCollection matchedReg = rg.Matches(input); input = ""; foreach (Match match in matchedReg) Console.WriteLine(match.Groups[0]); } static void Main(string[] args) { string input = ""; string line; while((line= Console.ReadLine())!=null){ input += line; input += ' '; } input = input.Remove(input.Length-1); string pattern = @"(?:[a-zA-Z]+[a-zA-Z0-9]*)(?:\[(?:[a-zA-Z]+[a-zA-Z0-9]*|[0-9]+)\])?(?:\s*)(?:\=)(?:\s*)(?:[0-9]+|(?:(?:[a-zA-Z]+[a-zA-Z0-9]*(?:\[(?:[a-zA-Z]+[a-zA-Z0-9]*|[0-9]+)\])?)+)|(?:\s*)(?:(?:(?:[1-9]+(?:0*))+|0|(?:[a-zA-Z]+[a-zA-Z0-9]*(?:\[(?:[a-zA-Z]+[a-zA-Z0-9]*|(?:[1-9]+(?:0*))+|0)\])?)+)(?:\s*)(?:(?:[+\-*\/])(?:\s*)(?:(?:[1-9]+(?:0*))+|0|(?:[a-zA-Z]+[a-zA-Z0-9]*))(?:\[(?:[a-zA-Z]+[a-zA-Z0-9]*|[0-9]+)\])?(?:\s*))+)+)(?:\s*)(?:\;)"; rgex(input, pattern); } } }
How to decompose the pattern into several short strings to make it more readable without affecting the function of the code, please give the decomposed short string
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
