// Assuming your column is named “string” and the result should be a new column named “Result”
// Import necessary classes
import java.util.regex.Matcher;
import java.util.regex.Pattern;
// Define the regular expression pattern
Pattern pattern = Pattern.compile(“pat: (\w+)”);
// Loop through each row in the input table
for (int i = 0; i < string.length; i++) {
// Get the value from the “string” column
String inputString = string[i];
// Create a matcher object
Matcher matcher = pattern.matcher(inputString);
// Check if the pattern is found
if (matcher.find()) {
// Get the matched value
String matchedValue = matcher.group(1);
// Determine the result based on the matched value
String result;
if (matchedValue.equals("12#₹&4")) {
result = "TP";
} else if (matchedValue.equals("hop")) {
result = "CHECK";
} else {
result = "UNKNOWN"; // You can adjust this based on your needs
}
// Set the result in the output column
Result[i] = result;
} else {
Result[i] = "NO_MATCH"; // If the pattern is not found
}
}