masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
^.*\\]\\s+Attack Of Opportunity\\s+:\\s+(.+)\\s+attacks\\s+(.+)\\s+\\[.*\\*([\\w]+)\\*.*\\+\\s+(\\d+)\\s+=.*$
See the tutorials, and thenyou tell me how you think it works. And this is a simple "brute force" method.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
^.*\\]\\s+Attack Of Opportunity\\s+:\\s+(.+)\\s+attacks\\s+(.+)\\s+\\[.*\\*([\\w]+)\\*.*\\+\\s+(\\d+)\\s+=.*$
so the ^.*\\] takes all of the text to the left of the last bracket and states that as part of a regex. after that, the \\s defines a space, and then the phrase Attack Of Opportunity is checked for. then, it checks for another space with \\s, then a colon, then another space, then the name with (.+), then another space, then the phrase attacks, and then another space. after that, it checks for a second name, then a space, and then after that i *believe* that it checks for an "*" then a word, and then another "*"followed by a space, then a series of digits followed by an "=" and a string of length 0 or more. then the strign terminates. I think this is what you were asking for, and i think i could reproduce the beginning but the end would be extremely confusing for me to create.
TJ
The bold part is wrong. followed by "anything" then a space, a plus, a space, numbers, a space, "=", and "rest of string". The four groups of parens are save blocks, so there is your saved name1, name2, "miss", and "113".
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
See the second and third links above. The first is general regex, not just Java.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
What do the Pattern and Matcher API docs say about "capturing groups" and what does the Java regex tutorial show about it?
Write a small test program with that String hard-coded in and try out varying patterns and varying ways of using Pattern and Matcher. Once you have done that, and it is still working as you think it should post that code here and I will help you get it right, but I have pointed you to exactly what you need (which at this point is the second and third links) you just need try it out.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
A VB Complaint
This is a Java forum. Go to the VB forum and post a new question there (i.e. start anew thread, do not hijack someone else's).
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
Maybe not, but VB is much closer to it than Java.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
Still closer than Java though. Maybe try a JavaScript forum? Or even better this
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494