I am trying to match a group in regex but I don't want this group to be in the final result.
For example:
((kl(\.)?|at)?
([0-1][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?)
Running the above expression on at 12:25
should return 12:25
.
Is there any way to do this?
I tried using:
(?:((kl(\.)?|at)? )([0-1][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?)
But that's no difference.
Then I tried
(?<!(?:((kl(\.)?|at)? )([0-1][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?)
But that returned an empty result.
I am using the expression in C#.
A non-capturing group (not found in the match groups) is denoted as (?:). So,
(?:(?:kl(?:\.)?|at)?([0-1][0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?)
But you regexp seems to be wrongly structured from the outset. You don't capture the minutes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With