regex - Regex get part from "=" first occurence to left and rest to right
问题描述
I can't resolve this case:
hdfs://sandbox-hdp.hortonworks.com:8020/test/r/abc=1/day=1
Need to extract
/abc=1/day=1
So in this case we need to start from first occurence of =
character and then get everything to the left till first occurence of /
character and rest to right.
For now I only know how to get everything to right with this: =.*
解决方案
$ echo "hdfs://sandbox-hdp.hortonworks.com:8020/test/r/abc=1/day=1" | grep -oE '[^/]+=.*'
推荐阅读
- python - 使用 Jupyter 时,我必须使用 Conda 而不是 cmd 提示符安装 python 模块。为什么?
- .net - PowerShell/.NET 中是否有内置属性或方法来检查正在使用的 XML 是否已被修改?
- javascript - D3JS:我无法迭代数组
- reactjs - 如何为“react-select”实现字段验证
- javascript - 超级账本查询从不返回结果
- sas - 错误:_Imputation 值不是有效的 SAS 名称
- sql - 获取开始日期和结束日期之间的日期
- android - 在单元测试中订阅 Observable 时出现 NullPointerException
- c# - Unity播放模式下,如何更改脚本私有字段并自动刷新
- java - @Factory 注解不会按需要执行 testng 类