i have a string:
Recent overs</b> <tt>. . . . . . <b>|</b> 3 . . 1b 4 .<b>|</b> 1 1 1 . . 4 <b>|</b> . . . 4 . .</tt></p>
It is all in a single line, so how would I extract only the information about the balls, ie
output should be . . . . . . 3 . . 1b 4 . 1 1 1 . . 4 . . . 4 . .
The closest i got was with [^(Recent overs|<b>|<tt>|</b>|</tt>|</p>)]+, but it matches the 1 and not 1b.
First, the brackets
[]are used for creating what is called a “character class” – this is meant to represent a single character. Your code effectively says don’t match these characters:(Recntovrsbp|<>/You’d be better off using a regex to remove the unwanted strings, then it’s easier to parse the result, like this:
Javascript, because you didn’t specify the language
jsfiddle example
The resulting ‘s’ is much easier to parse.