Hi,
I thought I was fairly useful at regexes, until I met rsyslog. Which has me severely stumped.
I am trying to parse a really simple string:
ncy-rest01-hel.example.com
to extract the "nyc" part (i.e everything in front of the '-' ). Now, usually I would simply use:
(\w*)-.*
and point at the capture group. But nope, that won't match. Fine, I thought. Maybe:
(\w*)-(.*)
And specify the first capture group. But no. Basically, the only thing that halfway works is:
(\w*)
...but the problem is that will also match:
nope.example.com
without a dash in the hostname. Which it should not (and thus trigger a nomatch).
The regex checker is not explaining what is going on, and regex101 does not support things like ERE or BRE, so that's no help...
-------------------------------------------------------------------
The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorized use, dissemination of the
information or copying of this message is prohibited. If you are not the
addressee, please notify the sender immediately by return e-mail and delete
this message.
Thank you
_______________________________________________
rsyslog mailing list
https://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.
I thought I was fairly useful at regexes, until I met rsyslog. Which has me severely stumped.
I am trying to parse a really simple string:
ncy-rest01-hel.example.com
to extract the "nyc" part (i.e everything in front of the '-' ). Now, usually I would simply use:
(\w*)-.*
and point at the capture group. But nope, that won't match. Fine, I thought. Maybe:
(\w*)-(.*)
And specify the first capture group. But no. Basically, the only thing that halfway works is:
(\w*)
...but the problem is that will also match:
nope.example.com
without a dash in the hostname. Which it should not (and thus trigger a nomatch).
The regex checker is not explaining what is going on, and regex101 does not support things like ERE or BRE, so that's no help...
-------------------------------------------------------------------
The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorized use, dissemination of the
information or copying of this message is prohibited. If you are not the
addressee, please notify the sender immediately by return e-mail and delete
this message.
Thank you
_______________________________________________
rsyslog mailing list
https://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/
What's up with rsyslog? Follow https://twitter.com/rgerhards
NOTE WELL: This is a PUBLIC mailing list, posts are ARCHIVED by a myriad of sites beyond our control. PLEASE UNSUBSCRIBE and DO NOT POST if you DON'T LIKE THAT.