I have a text file that I iterate over and want to check for multiple substrings in each line (1 substring will exist per line).
my regex is the following
String rE = "(AGG|TIP|IDV|DVY|IYR|LQD|HYG|EMB|ACWI|ACWX|EFA|SCZ|EEM|IWB|IWF|IWD|IWM|IWO|IWN|IWV|IVV|IVW|IVE|IJH|IJK|IJJ|MUB|IJR|IJS|IJT|SPY)"
and a line of my text file looks like this:
SPY,6696832,31080,140.7,400,140.69,140.69,6396960,299872
yet when i do:
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
System.out.println("Starting");
while ((retStr = in.readLine()) != null) {
if(retStr.matches(tickers)){
System.out.println(retStr);
}
}
I do not find my strings.
The code compiles and runs perfectly. I iterate over the file, yet I never find my result.
Could I please have some help on what I am doing wrong?
matches(...)must match the whole String. Consider showing more file lines so we can see other configurations of your text lines that you must analyze.