c# - 选择特定文本的正则表达式
问题描述
<b>Dummy Alerts: </b>3/3Alerts have been addressed 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 Question Alert: Have you been drinking more fluid? " +
" Yes Alert is closed on 10/09/2019 at 01:08 PM 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# 中使用正则表达式。
你能帮忙吗?
解决方案
using System;
class Program
{
static void Main()
{
string dummyString = "<b>Dummy Alerts: </b>3/3Alerts have been addressed 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 Question Alert: Have you been drinking more fluid? " +
" Yes Alert is closed on 10/09/2019 at 01:08 PM 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[]{" "}, StringSplitOptions.None);
Console.WriteLine(splitted[splitted.Length-1]);
// With String.LastIndexOf & String.Substring
int lastIndex = dummyString.LastIndexOf(" ");
Console.WriteLine(dummyString.Substring(lastIndex+5));
}
}
写了两次:
Ram 支持访问进行了 10/9/17,重量 90.2 公斤(干)。台湾实现了。无外周水肿。BP 在每个患者病史的常规范围内。尿量1050ml。目前没有 PO 流体限制。患者确实忘记带入流程图。在一周内通过流程图审查监控 UF 趋势。米歇尔·梅休·史密斯,注册护士。
推荐阅读
- regex - 使用 Regex 而不是 ImportXML 将 Google 搜索结果带入 Google 表格
- python - 使用弹性搜索和 python 提高性能
- javascript - 用于匹配包含一个单词并排除另一个单词的 URL 的正则表达式
- visual-c++ - 为什么我的重载构造函数会导致崩溃?
- c# - 为什么我从飞机上掉下来?
- java - 在循环运行时获取控制台读数
- ios - 无法在 iOS 模拟器上通过 Google 登录
- python - 在 Windows 上编译协议缓冲区 Tensorflow 对象检测 API
- node.js - 如何在 Docker 中更改 package.json 的文件路径?
- gradle - 从 Gradle 创建 PlantUML 图表