15,6 → 15,8 |
*/ |
package net.brutex.xservices.ws.impl; |
|
|
|
import java.util.regex.Matcher; |
import java.util.regex.Pattern; |
|
33,9 → 35,9 |
@WebService(targetNamespace = BrutexNamespaces.WS_XSERVICES, endpointInterface = "net.brutex.xservices.ws.StringService", serviceName = StringService.SERVICE_NAME) |
public class StringServiceImpl implements StringService { |
|
public StringReplaceType replaceRegEx(String res, String search, |
String replace, String flags) throws XServicesFault { |
try { |
public StringReplaceType replaceRegEx(String res, String search, String replace, |
String flags) throws XServicesFault { |
|
int allflags = 0; |
if (flags.contains("i")) { |
allflags = allflags + Pattern.CASE_INSENSITIVE; |
49,15 → 51,11 |
if (flags.contains("g")) { |
return new StringReplaceType(matcher.replaceAll(replace), count); |
} else { |
if (count > 1) |
count = 1; |
return new StringReplaceType(matcher.replaceFirst(replace), |
count); |
if(count>1) count = 1; |
return new StringReplaceType(matcher.replaceFirst(replace), count); |
} |
} catch (Exception e) { |
throw new XServicesFault(e); |
} |
|
} |
|
|
} |