I would like to separate the two names (Guardian of Water and Kyton's Rebuke [BH]) and use the word killed as a keyword in an if...else... statement. Keep in mind however that the names can be extremely long or extremely short - there is no limit to the number of words in a name.

Also, for a line such as:
[CHAT WINDOW TEXT] [Sun Nov 29 11:34:10] Attack Of Opportunity : Soul Devourer attacks Kyton's Rebuke [BH] : *miss* : (13 + 113 = 126)
I would like to parse out the names (Soul Devourer and Kyton's Rebuke[BH]), the miss, and the 113.

Any ideas would be greatly appreciated, as i am a relatively new java programmer.

Thanks for the response masijade. I am still confused however how i would format a regex for a line like this:
[CHAT WINDOW TEXT] [Sun Nov 29 11:34:10] Attack Of Opportunity : Soul Devourer attacks Kyton's Rebuke [BH] : *miss* : (13 + 113 = 126)
I this line i would need the Attack of Opportunity, both names, the miss, and the 113 recorded somewhere. i can probably use colons to separate some pieces, but i am not sure as to how i can separate the 113 by looking for the + and = signs in that expression. and sometimes there will be more than one of those expressions on the end of the line, but the second is nothing to worry about. I have come up with a list of strings that i need to check for, and could be used to help separate names and other changing parts of the expression.

But again, i am not sure how i would go about using terms like these to create regex statements. If someone wouldn't mind giving me an example and explaining how they created it (in newbie java terms) so i could try to create the rest, it would be greatly appreciated.

^.*\\]\\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.

^.*\\]\\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".

ah okay thanks you very much. and how would i save them to individual variables?

Im trying to make a log parser that is going to have a lot of lines printed to it every second at times and they are going to vary type so i am trying to get the regex statements down as i believe this is the most efficient way to parse the files.

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.

okay well its no longer letting me edit my post, so i have to create a new one. I have succeeded in storing groups, etc, but i have found that the regex you gave me does not register the [BH] at the end of the players name. Run the code and i will show you what i mean.

I have added two comments, because i have noticed the speed of the program varying greatly if i move one of my matching statements, and at the speed it moves at where the statement is (and should be) is not acceptable.... anyone have any ideas?

I have used Mid,InStr and other methods to get a substring of a string from one text file and copied the required string to another text file. While I get the correct string, vbscript however generates a BLANK SPACE after evry character in the output string.

I tried to use the Replace function inorder to replace the " " with ""... but the function does not detect any blank spaces at all to replace.

Instead of copying to another file, I even tried to replace the undesired part of the string with a " " and get only the required part ... but then again it gives the same problem[ a BLANK SPACE after evry character]

Hi. so this is actually a continuation from another question of mine[Here](https://www.daniweb.com/programming/software-development/threads/506795/dynamically-add-values-into-datagridview-cell-from-listbox-vb2010) but i was advised to start a new thread as the original question …

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...