javascript - Parse Seats from PokerStars History -


i have following string:

seat 6: dizzy (€26.49 in chips)  

i parse seatnumber (6), screenname of player (dizzy), , stack (26.49). possible 1 regex ?

here try:

    seat.([0-9])      :     .   //space     ([^(]*)  //screenname (everything next opening parenthesis)     \(     [^0-9]+ // euro or dollar sign     ([0-9\.]+) // stack     .in.chips  

but doesn't work if screenname has parenthesis, example :

seat 3: padre(93) (€10.52 in chips)  

your "screenname" section needs adjusted from:

([^(]*) 

to:

(.*) 

quantifiers greedy default -- match as possible, while still allowing rest of pattern match. in case want match last ( character.

modifying pattern way cause .* pattern match end of string, regex engine notice causes pattern fail match. backtrack last (, rest of pattern match.

see this test illustration of how modification affect matches.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -