Bug 326040 - Regex highlight pattern
Summary: Regex highlight pattern
Status: RESOLVED WORKSFORME
Alias: None
Product: konversation
Classification: Applications
Component: general (show other bugs)
Version: 1.5-rc1
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-15 09:29 UTC by Nick Cross
Modified: 2013-10-15 16:06 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Cross 2013-10-15 09:29:23 UTC
This might be a documentation issue but....its unclear exactly what regex are supported and what it will match in a channel.

On a channel a typical messages might be

[27/09/2013 15:03] <nc> ther: Yeah
[27/09/2013 14:55] [Notify] fnr is online (irc.xxxx.com).
[27/09/2013 14:22] <-- tk (~tk) has left this channel (Leaving).

I want it to match just the conversations i.e. the first line, none of the notify or channel messages (and ignore the date/time).  So far crafting any regex more complex  than a simple .* pattern doesn't seem to work. 


Reproducible: Always

Actual Results:  
What would be nice is better documentation on what is supported and how to match different parts of the channel messages,
Comment 1 Eike Hein 2013-10-15 09:35:10 UTC
The regular expression syntax is documented here: http://qt-project.org/doc/qt-4.8/qregexp.html

Everything except for the timestamp is matched.
Comment 2 Nick Cross 2013-10-15 12:26:48 UTC
Should this regexp matching information be linked from the docs? 

I've tried <.*>.* or <\w+>.* and the matching / notification still doesn't work correctly.
Comment 3 Eike Hein 2013-10-15 12:28:26 UTC
Docs: Probably, patches welcome.

Regex: Let's take a step back. What's your overall goal?
Comment 4 Nick Cross 2013-10-15 12:46:08 UTC
Regex:  using the above sample

 [27/09/2013 15:03] <nc> ther: Yeah 
[27/09/2013 14:55] [Notify] fnr is online (irc.xxxx.com). 
[27/09/2013 14:22] <-- tk (~tk) has left this channel (Leaving). 

I want to match 
<any_nickname> any_random_text
It seems any regex that contains '<' or '>' does not seem to match correctly.
Comment 5 Eike Hein 2013-10-15 12:48:11 UTC
Let's take another step back: Why do you want to do this?
Comment 6 Nick Cross 2013-10-15 12:50:11 UTC
:-) I want to monitor general messages on several company channels. But I don't want to see general channel join/leave etc messages in the notification.
Comment 7 Eike Hein 2013-10-15 13:03:07 UTC
Konversation 1.5 has the ability to set a whitelist of windows as a constraint for a highlight, so you could simply go with .* + channel names there. Otherwise I'd recommend using Configure Notifications -> Command instead and writing a small script to be called from there (that can in turn use e.g. kdialog to spawn desktop notifications).
Comment 8 Nick Cross 2013-10-15 13:22:40 UTC
I am using Konversation 1.5 and it does indeed work. The only problem is the regex matcher doesn't not seem to work.
Comment 9 Eike Hein 2013-10-15 13:33:57 UTC
I don't understand what you need the regex matcher for, though?
Comment 10 Nick Cross 2013-10-15 14:35:08 UTC
Referring to my three line example again. If I have a regex matcher of .* it notifies me for everything. What I really wanted was a regex so  I could look for actual conversations not join/leave events. Therefore a regex of 
<.*>.* 
should notify me in a nice popup of 
[27/09/2013 15:03] <aperson> ther: Yeah
but not of
[27/09/2013 14:55] [Notify] fnr is online (irc.xxxx.com). 
[27/09/2013 14:22] <-- tk (~tk) has left this channel (Leaving).
Comment 11 Eike Hein 2013-10-15 14:41:07 UTC
Right, ok. The nick isn't part of the match (sorry for the wrong info above). I recommend using Configure Notifications -> Command and running a script from there, or writing a regex that explicitly blacklists the phrases you don't want to match. Or you could disable the showing of join/nick/part events in Behavior -> Chat Window.
Comment 12 Nick Cross 2013-10-15 16:00:16 UTC
Ah ok. Thanks for the info. I've disabled showing those events for now.