c# - 有没有办法从类似数学的函数中获取参数?
问题描述
考虑以下字符串示例:
x + 1 (y * 8) ^ w,z example.test
我希望能够得到:
x
y
w
z
example.test
解决方案
提取匹配正则表达式模式的子字符串:
var regex = new System.Text.RegularExpressions.Regex("[a-zA-Z_$][a-zA-Z_$\\.0-9]*");
var matches = regex.Matches("x + 1 (y * 8) ^ w,z example.test");
遍历结果MatchCollection
以获取表示相关标识符的字符串。
推荐阅读
- neo4j - Neo4J 变量别名无法识别
- reactjs - 仅当用户从 Stripe 成功购买时才允许他们进行有限访问
- java - 使用二进制搜索在数组中查找一个元素,使得索引等于它的值
- sql - 如何将数据从 12c 本地数据库迁移到 18c atp 数据库?
- javascript - 单击表格行时如何滚动到具有固定标题的页面上的元素?
- javascript - 如何替换字符串的所有匹配项?
- opencv - OpenCV 检测和计算图像特征
- c# - EF 创建数据库并在其名称中添加 guid
- classification - 具有训练、开发、测试、预测模式的 BERT
- google-apps-script - 当 J 的值 = false 时,向人员列表发送一封自动电子邮件