[CSharp] parsing files, or using regular expressions faster

Source: Internet
Author: User
Obtain an alarm from BSC
Allip;

Use a program to solve the problem? I am too tired to use regular expressions for convenience.


 
Use it to generate code // using System. Text. RegularExpressions;

/** // <Summary>
/// Regular expression built for C # on: Friday, February 1, 2006, 03:12:38
// Using Expresso Version: 2.1.1822, http://www.ultrapico.com
///
/// A description of the regular expression:
///
/// [1]: A numbered capture group. [\ w {2}]
/// Alphanumeric, exactly 2 repetitions
////
/// [2]: A numbered capture group. [\ w {3}]
/// Alphanumeric, exactly 3 repetitions
/// \ S"
/// Whitespace
/// [3]: A numbered capture group. [\ w +/\ d +]
/// \ W +/\ d +
/// Alphanumeric, one or more repetitions
////
/// Alphanumeric, one or more repetitions
////
/// Any digit, one or more repetitions
/// "\ S
///"
/// Whitespace
/// [4]: A numbered capture group. [\ d +], one or more repetitions
/// Any digit, one or more repetitions
/// Whitespace
/// [5]: A numbered capture group. [\ d +], one or more repetitions
/// Any digit, one or more repetitions
/// Whitespace, one or more repetitions
/// [6]: A numbered capture group. [\ d +]
/// Any digit, one or more repetitions
/// \ S + \ r \ n
/// Whitespace, one or more repetitions
/// Carriage return
/// New line
/// [7]: A numbered capture group. [. *]
/// Any character, any number of repetitions
/// \ R \ n
/// Carriage return
/// New line
/// [8]: A numbered capture group. [. *]
/// Any character, any number of repetitions
/// \ R \ n
/// Carriage return
/// New line
/// Carriage return
/// New line
/// [9]: A numbered capture group. [. *]
/// Any character, any number of repetitions
/// \ R \ n
/// Carriage return
/// New line
/// [MO name]: A named capture group. [. *?]
/// Any character, any number of repetitions, as few as possible
/// Whitespace, one or more repetitions
/// [10]: A numbered capture group .[? <Base Station Name>. *?]
///? <Base Station Name> .*?
///? <Base Station Name>
/// Any character, any number of repetitions, as few as possible
/// Whitespace, one or more repetitions
/// [11]: A numbered capture group. [. {1}]
/// Any character, exactly 1 repetitions
/// \ R \ n
/// Carriage return
/// New line
/// Carriage return
/// New line
/// [12]: A numbered capture group .[? <Alarm type>. *]
///? <Alarm type> .*
///? <Alert type>
/// Any character, any number of repetitions
/// \ S * \ r \ n
/// Whitespace, any number of repetitions
/// Carriage return
/// New line
/// [13]: A numbered capture group .[? <Alert content>. *?]
///? <Alert content> .*?
///? <Alert content>
/// Any character, any number of repetitions, as few as possible
/// \ S * \ r \ n
/// Whitespace, any number of repetitions
/// Carriage return
/// New line
/// Carriage return
/// New line
/// Carriage return
/// New line
/// Carriage return
/// New line
///
///
/// </Summary>
Public static Regex EricssonBscAlarmRegex = new Regex (
@ "(\ W {2})/(\ w {3}) \ s" "(\ w +/\ d +) "" \ s (\ d +) + \ s + (\ d +) \ s"
+ @ "+ \ R \ n" + "\ r \ n" + @"(. *) \ r \ n "+" \ r \ n "+ @"(. *) \ r \ n "+" \ r \ n "+ @" \ r \ n "+" \ r \ n "+ @"(. *) \ r \ n "+" \ r \ n "+ @"(? <MO Name> .*?) \ S + (? "
+ @ "<Base Station Name> .*?) \ S + (. {1}) \ r \ n "+" \ r \ n "+ @" \ r \ n "+" \ r \ n "+ @"(? <Alarm type>. *) \ s * \ r \ n "+" \ r \ n "+ @"(? <Alarm content> ."
+ @"*?) \ S * \ r \ n "+" \ r \ n "+ @" \ r \ n "+" \ r \ n "+ @" \ r \ n "+" \ r \ n "+ @" \ r \ n ",
RegexOptions. IgnoreCase
| RegexOptions. Multiline
| RegexOptions. CultureInvariant
| RegexOptions. IgnorePatternWhitespace
| RegexOptions. Compiled
);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.