L
laredotornado
Hi,
I'm using Java 6. I'm trying to write a regexp, which is failing, but
I can't figure out why (same expression works in Perl). Here is my
code ...
final Pattern addPattern = Pattern.compile("\\s*ADD\\s+([^\\s]+)\
\s*", Pattern.MULTILINE);
final Matcher addMatcher = addPattern.matcher(cellValue);
but the call "addMatcher.matches()" returns false for Strings that
look like they match to me. Here is one of them
cellValue = "ADD 6CCRASR.1 ADD 6CCRASR.2 ADD
6CCRASR.3 ADD 6CCRASR.5 ADD 6CCRASR.
10 ADD 6CCRASL.3 ADD 6CCRASL.5\nADD 6RSL.
1\nADD 6RSL.2\nADD 6RSL.3\nADD 6RSL.5\nADD 6RSL.10\nADD 6RSIT.1\nADD
6RSIT.2\nADD 6RSIT.3\nADD 6RSIT.5\nADD 6RSIT.10\nADD 6LS.5.b "
The "\n"'s are newline characters. Any idea what is wrong with the
above regexp or my code? Thanks, - Dave
I'm using Java 6. I'm trying to write a regexp, which is failing, but
I can't figure out why (same expression works in Perl). Here is my
code ...
final Pattern addPattern = Pattern.compile("\\s*ADD\\s+([^\\s]+)\
\s*", Pattern.MULTILINE);
final Matcher addMatcher = addPattern.matcher(cellValue);
but the call "addMatcher.matches()" returns false for Strings that
look like they match to me. Here is one of them
cellValue = "ADD 6CCRASR.1 ADD 6CCRASR.2 ADD
6CCRASR.3 ADD 6CCRASR.5 ADD 6CCRASR.
10 ADD 6CCRASL.3 ADD 6CCRASL.5\nADD 6RSL.
1\nADD 6RSL.2\nADD 6RSL.3\nADD 6RSL.5\nADD 6RSL.10\nADD 6RSIT.1\nADD
6RSIT.2\nADD 6RSIT.3\nADD 6RSIT.5\nADD 6RSIT.10\nADD 6LS.5.b "
The "\n"'s are newline characters. Any idea what is wrong with the
above regexp or my code? Thanks, - Dave