15,8 → 15,6 |
*/ |
package net.brutex.xservices.ws.impl; |
|
|
|
import java.util.regex.Matcher; |
import java.util.regex.Pattern; |
|
35,9 → 33,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 { |
|
public StringReplaceType replaceRegEx(String res, String search, |
String replace, String flags) throws XServicesFault { |
try { |
int allflags = 0; |
if(flags.contains("i")) { |
allflags = allflags + Pattern.CASE_INSENSITIVE; |
51,11 → 49,15 |
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); |
} |
|
} |
|
|
} |