Регулярное выражение для выбора конкретного текста - PullRequest
0 голосов
/ 03 октября 2018
<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 голосов
/ 03 октября 2018
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));
    }
}

Пишет дважды:

Визит в службу поддержки поршня выполнен 10/9/17, вес 90,2 кг (сухой).TW достигнут.Нет периферических отеков.АД в пределах обычного диапазона на историю болезни пациента.Вывод мочи 1050мл.В настоящее время нет ограничений по расходу PO.Пациент забыл принести листы.Мониторинг тренда УФ с обзором технологической схемы в течение одной недели.Мишель Мэйхью Смит, RN.

...