将c#正则表达式转换为Java

本文关键字:Java 转换 正则表达式 | 更新日期: 2023-09-27 18:19:17

c#中的正则表达式在java中会给我错误:

"<input type="hidden" name="GALX" value="(?<galx>[a-zA-Z0-9_]+)">"  
错误:

Look-behind group does not have an obvious maximum length near index 60
<input type="hidden" name="GALX" value="(?<galx>[a-zA-Z0-9_]+)">

在Java中等价的表达式是什么?

将c#正则表达式转换为Java

我猜。我将'改为'并转义了任何'

"<input type='"hidden'" name='"GALX'" value='"(?<galx>[a-zA-Z0-9_]+)'">" 

Edit::对于"galx"的命名分组,只有java 7支持这个

Java中的Regex Named Groups