I want to match an expression like this:
500 q 6h
Where the numbers can be any integer (thus 2 q 500h is also a legal expression).
I'm trying to match this pattern using the following regular expression
(\W|^)\d+ q \d+h(\W|$)
Using this pattern, I would expect a string like
a500 q 6h to be not matched. Instead it is matched.
Similarly, I would expect a string like
(500 q 6h) to be matched, but it is not matched.
I don't get what I'm doing wrong.
\W\$is almost certainly incorrect, and there's likely a+missing after the second\dalso. Be sure that your\Ware actually uppercase.(500 q 6h)though.