import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "\\d (?![A-Z]*BNB)([A-Z]+)";
final String string = "['Sender Receiver Amount Currency',\n"
+ " '0x10ed43c718714eb63d5aa57b78b54704e256024e',\n"
+ " '0x5b9f811d38fc6c1017e0774c552235b33f564deb',\n"
+ " '1.00 WBNB',\n"
+ " '0x10ed43c718714eb63d5aa57b78b54704e256024e',\n"
+ " '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c',\n"
+ " '1.00 BNB',\n"
+ " '0x5b9f811d38fc6c1017e0774c552235b33f564deb',\n"
+ " '0x6b1ecb203d82fec24f8b684f7906ef98ec9abf0a',\n"
+ " '596.32 RBH',\n"
+ " '0x6b1ecb203d82fec24f8b684f7906ef98ec9abf0a',\n"
+ " '0x10ed43c718714eb63d5aa57b78b54704e256024e',\n"
+ " '1.00 BNB',\n"
+ " '0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c',\n"
+ " '0x10ed43c718714eb63d5aa57b78b54704e256024e',\n"
+ " '1.00 WBNB']";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html