Which of the following patterns will correctly capture all Hex numbers that are delimited by atleast one whitespace in an input text?
1) \s*0[xX][0-9a-fA-f]+\s*
2) \s0[x][X][0-9a-fA-f]+\s
3) \s*0[xX][0-9a-fA-f]*\s*
4) 0[xX][0-9a-fA-f]+\s
5) \s0[xX][0-9a-fA-f]?\s
Option 1: a hex number that starts with 0 or more spaces with x or X prefix and 0-9 or a-f or A-F occurrence one or more and ends with 0 or more spaces.
I don't think option 2 correct because it says x and X both, erroneous.
Option 4 looks good, but it must end with a space
Option 5 is not true because it write ? at the end (means 0 occurrence of 0-9, a-f or A-f will do, that is not true.
I find option one correct.
Please correct me if I miss something there!