Can someone please explain why the \d character class is not matching for me? An example from the relevance language reference has:
Q: parenthesized part 1 of ( matches (regex “(\d\d\d\d)(\d\d)(\d\d)” ) of “20051201”)
A: 2005
But when I run qna on redhat 5, client 9.2.0.363 or 9.0.787.0, the \d digit character class does not seem to match. I get this:
Q: parenthesized part 1 of ( matches (regex “(\d\d\d\d)(\d\d)(\d\d)” ) of “20051201”)
E: Singular expression refers to nonexistent object.
T: 329
I: substring
It is obvious that the digit \d character class regex is not recognized when you do this:
Q: parenthesized part 1 of ( matches (regex “(\d\d\d\d)(\d\d)(\d\d)” ) of “dddddddd”)
A: dddd
T: 330
I: substring
On the other hand the whitespace \s class does seem to work:
Q: parenthesized part 1 of ( matches (regex “(\d\s\s\d)(\d\d)(\d\d)” ) of “d ddddd”)
A: d d
T: 214
I: substring
Notice that a range character class works:
Q: parenthesized part 1 of ( matches (regex “([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])” ) of “20051201”)
A: 2005
T: 359
I: substring
Also POSIX digit character class works too:
Q: parenthesized part 1 of ( matches (regex “([[:digit:]][[:digit:]][[:digit:]][[:digit:]])([[:digit:]][[:digit:]])([[:digit:]][[:digit:]])” ) of “20051201”)
A: 2005
T: 280
I: substring
Here is an example from usgcb oval that made me notice this issue:
<ind-def:pattern operation="pattern match">^[\s]*PASS_MIN_LEN[\s]*([\d]+)</ind-def:pattern>
(It is interesting to note that whoever wrote that put those character classes into brackets which is unnecessary.)