The loop tries each regex in order. When you find a regex that matches then none of the remaining regexs can possibly match so there's no point in checking them. Break causes loop to abort because we already found one.
Babi Astimal Astimal wrote:can you explain the use of breck in your code ?
Babi Astimal Astimal wrote:now just for design purpuse I want my result will be displayed inside JtextArea with use of JRadioButton in order to get bellow information can you help us ?
This is my approach to handling multiple regex's: I built a helper class called "Group" that is easily processed in a loop. And to reiterate: no GUI and no formatted output at this point.
Exception in thread "main" java.lang.ExceptionInInitializerError
Caused by: java.lang.NullPointerException
at java.util.regex.Pattern.<init>(Unknown Source)
at java.util.regex.Pattern.compile(Unknown Source)
Knute Snortum wrote:It looks like you've forgotten to set REGEX_1 etc. to your regex string.
Babi Astimal Astimal wrote:shall I ask help again?
Babi Astimal Astimal wrote:3/ I have tried to make add ( data.equals("INFOP-") and remove the loop
Of course you would.
but i get only one line