I'm trying to use regular expressions in TypeScript to
- Check if a given string matches an expression
- Extract a substring
These are the two strings I'm trying to match against
Total Order <orderId>
ex: Total Order order1
, I should be able to extract order1
from the regular expression
The other string I'm trying to match against is. I have been trying to do this without any success, I came across the following but no success How do you access the matched groups in a JavaScript regular expression?, but this is different from what I'm trying to do.
Items Order <orderId>
, the could have spaces as well
ex: Items Order order1
. I should be able to extract order1
from this again.