2023-06-09 16:47:25 +02:00
|
|
|
|
|
|
|
package eu.dnetlib.dhp.schema.oaf.utils;
|
|
|
|
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
public class FundRefCleaningRule {
|
|
|
|
|
2023-06-23 16:10:49 +02:00
|
|
|
public static final Pattern PATTERN = Pattern.compile("\\d+");
|
2023-06-09 16:47:25 +02:00
|
|
|
|
2023-06-23 16:10:49 +02:00
|
|
|
public static String clean(final String fundRefId) {
|
|
|
|
|
|
|
|
String s = fundRefId
|
2023-06-09 16:47:25 +02:00
|
|
|
.toLowerCase()
|
|
|
|
.replaceAll("\\s", "");
|
|
|
|
|
2023-06-23 16:10:49 +02:00
|
|
|
Matcher m = PATTERN.matcher(s);
|
|
|
|
if (m.find()) {
|
2023-06-09 16:47:25 +02:00
|
|
|
return m.group();
|
|
|
|
} else {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|