Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. i'm trying to make a log parser for final fantasy 14, using regexs to pull out interesting information from each line of the game's logs.
  2.  
  3. language: python
  4.  
  5. Sample lines:
  6. Critical! Your Light Slash hits the carrion chiglet from the left for 93 points of damage.
  7. Your Howling Vortex hits the carrier ladybug for 170 points of damage.
  8.  
  9. Desired result:
  10. from line 1: Critical!, Light Slash, carrion chiglet, left, 93
  11. from line 2: , Howling Vortex, carrier ladybug, , 170
  12.  
  13. my attempt/results:
  14. python regex: (?P<critical>Critical!\s|.*)Your\s(?P<attack>.*)\shits\s(the)?\s(?P<monster>.*)(\sfrom\sthe)?(?P<direction>.*)\sfor\s(?P<damage>\d*)\spoints
  15.  
  16. non python regex:(Critical!\s|.*)Your\s(.*)\shits\s(?:the)?\s(.*)(?:\sfrom\sthe)?(.*)\sfor\s(\d*)\spoints
  17.  
  18. line 1: Critical!, Light Slash, carrion chiglet from the left, , 93
  19. line 2: , Howling Vortex, carrier ladybug, , 170
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement