选择特定文本的正则表达式

时间:2018-10-03 06:21:55

标签: c# regex c#-4.0 c#-3.0

<b>Dummy Alerts: </b>3/3Alerts have been addressed&#10; Question Alert: Have you had problems or are your volumes lower than normal?  " +
            "Yes Alert is closed on 01/09/2018 at 01:08 PM&#10; Question Alert: Have you been drinking more fluid? " +
            " Yes Alert is closed on 10/09/2019 at 01:08 PM&#10;&#10;Ram support visit performed 10/9/17,  Weight 90.2kg (dry). " +
            "TW achieved. No peripheral edema. BP within routine range per patient history. Urine output 1050ml. No PO fluid restriction at this time. " +
            "Patient did forget to bring in flow sheets.  Monitor UF trend with flow sheet review in one week. Michelle Mayhew Smith, RN."

我的许多记录类型相似。

  

我要选择:-

 Ram support visit performed 10/9/17,  Weight 90.2kg (dry).
            TW achieved. No peripheral edema. BP within routine range per patient history. Urine output 1050ml. No PO fluid restriction at this time.
            Patient did forget to bring in flow sheets.Monitor UF trend with flow sheet review in one week. Michelle Mayhew Smith, RN.

在C#中使用正则表达式。

  

能请你帮忙吗??

1 个答案:

答案 0 :(得分:1)

using System;

class Program
{
    static void Main()
    {
        string dummyString = "<b>Dummy Alerts: </b>3/3Alerts have been addressed&#10; Question Alert: Have you had problems or are your volumes lower than normal?  " +
            "Yes Alert is closed on 01/09/2018 at 01:08 PM&#10; Question Alert: Have you been drinking more fluid? " +
            " Yes Alert is closed on 10/09/2019 at 01:08 PM&#10;&#10;Ram support visit performed 10/9/17,  Weight 90.2kg (dry). " +
            "TW achieved. No peripheral edema. BP within routine range per patient history. Urine output 1050ml. No PO fluid restriction at this time. " +
            "Patient did forget to bring in flow sheets.  Monitor UF trend with flow sheet review in one week. Michelle Mayhew Smith, RN.";

        // With String.Split    
        var splitted = dummyString.Split(new string[]{"&#10;"}, StringSplitOptions.None);
        Console.WriteLine(splitted[splitted.Length-1]);

        // With String.LastIndexOf & String.Substring
        int lastIndex = dummyString.LastIndexOf("&#10;");
        Console.WriteLine(dummyString.Substring(lastIndex+5));
    }
}

写两次:

  

Ram支持访问进行了10/9/17,体重90.2kg(干)。 TW实现了。无周围水肿。 BP在每个患者病史的常规范围内。尿量1050ml。目前没有PO液限制。病人确实忘记带流程图了。一周内通过流程图检查监控超滤趋势。 RN的Michelle Mayhew Smith。

相关问题