Regular Expression
42.0000 702.0000 moveto (6 fuel - 4.0%u235,3.35%gd2o3) show
42.0000 678.0000 moveto (8 outer clad - zr2.5nb) show
My expression is.
s.match("\s+\d+\w+\D+\W+\S+");
right or wrong?
and how can I get the last substring which is "show"?
Thanks
[308 byte] By [
ardmorea] at [2007-11-27 9:19:03]

> 42.0000 702.0000 moveto (6 fuel - 4.0%u235,3.35%gd2o3) show
> 42.0000 678.0000 moveto (8 outer clad - zr2.5nb) show
>
> My expression is.
> s.match("\s+\d+\w+\D+\W+\S+");
>
> right or wrong?
Wrong: it doesn't compile.
What is it you're trying to match? The entire line? You'll have to be a bit more specific.
> and how can I get the last substring which is
> "show"?
>
> Thanks
Split it on white spaces and the last element in the returned array is "show".
I think you could do that with a simpleString s2 = s1.substring(s1.indexOf('(')+1,s1.lastIndexOf(')'));(You will have to remove the spaces before the starting , perhaps by using the trim() method of StringBuffer)
So you want everything inside the parentheses?
Can there be other parens inside those--escaped or nested?
Can there be other parens on the line outside those, and if so, what do you want to get?
Will all inputs have parens, or will some have none?
You have to be very specific. Just providing one example isn't enough.
jverda at 2007-7-12 22:10:53 >
