我有下面的java脚本来提取字符串中出现“=”后的单词。正则表达式解释
例如:
string strOld="ActionDate=11/20/2014 12:00:00 AM ";
strOld.substr(strOld.indexOf(type)).substr(type.length +1, strOld.substr(strOld.indexOf(type)).substr(type.length).indexOf(" "))
这将提取“2014年11月20日”,从上述string.Since这是被“=”后存在的单词。
如何使用正则表达式重写?
我想要在同一个字符串变量中重新出现“=”的情况下得到逗号分隔的日期。
在有多个标志的情况下:
输入:字符串strOld = “ActionDate = 11/20/2014年12:00:00 AM SuspensionCode = 123”; 输出: “11/20/2014,123”
你能写完整的代码吗? – SmartestVEGA
@buckley这个'=(\ S +)'就够了。而且你还必须加上'g'修饰符。 –
单件作品,但多个我把以下表达,但它不工作 – SmartestVEGA