我正在尝试替换 groovy 中的大字符串。但不能让它工作。我正在使用 groovy 1.8.6
def textn = "http://10.33.0.69:8001/VS_SiteFacilityLookup/SiteFacilityLookupService?XSD=/com/enbridge/csim/ebo/module/common/serviceinterface/SiteFacilityLookupService.xsd"
textn = textn.replaceAll("http://10.33.0.69:8001/VS_SiteFacilityLookup/SiteFacilityLookupService?XSD=/com/enbridge/csim/ebo/module/common/serviceinterface/SiteFacilityLookupService.xsd", "hola")
println "textn : $textn"
这打印出原始变量
如果我替换较短的字符串,它会正确替换它。
def textn = "http://10.33.0.69:8001/VS_SiteFacilityLookup/SiteFacilityLookupService?XSD=/com/enbridge/csim/ebo/module/common/serviceinterface/SiteFacilityLookupService.xsd"
textn = textn.replaceAll("SiteFacilityLookupService.xsd", "hola")
println "textn : $textn"
这打印出预期的结果