parsing - Using Regex to find values in a file -


i'm not looking syntax help, per say, approach advice. here's need do:

i need read text in file containing moves (this part of chess game project) , print out move performed. here's example text i'm using text file:

edit: clarify, these each represent move. i.e. rla1 means white room moved a1, nlb1 means white knight b1, etc.

rla1 nlb1 blc1 qld1 kle1 blf1 nlg1 rlh1 pla2 plb2 plc2 pld2 ple2 plf2 plg2 plh2 rda8 ndb8 bdc8 qdd8 kde8 bdf8 ndg8 rdh8 pda7 pdb7 pdc7 pdd7 pde7 pdf7 pdg7 pdh7 b1 c3* b2 b3 d8 h4 

and here should output example input:

a white rook placed on a1 , white knight placed on b1 ... etc  white pawn ... etc  black rook ... etc  black pawn ... etc  piece on b1 moves c3 , captures piece there , piece on b2 moves b3 , piece on d8 moves h4 

obviously i'll use tostring() method override print moves out, need know how should go parsing input regex determine each move is.

again, not looking syntax advice on how should approach problem (pseudo)

i'm doing in java.

first, want split string individual moves. using language's string split function.

after doing this, can parse individual moves. note though chess moves can quite complex in standard notation, i'd suggest not trying mash 1 regexp. rather, create helper function such is_capture, is_castle, is_en_passant, get_moving_piece, , on.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -