Bug 462136

Summary: regex specs
Product: [Applications] konsole Reporter: netizen <rgawenda>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED NOT A BUG    
Severity: normal CC: ninjalj
Priority: NOR    
Version: 22.08.3   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description netizen 2022-11-22 17:11:54 UTC
SUMMARY
***
When searching in regex mode, I can't use Non Capturing groups
***


STEPS TO REPRODUCE
1. 
2. 
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE Neon 5.26
KDE Plasma Version: 5.26
KDE Frameworks Version: 5.100
Qt Version:  5.15.7

ADDITIONAL INFORMATION
Comment 1 Kurt Hindenburg 2022-11-25 03:36:40 UTC
Can you provide more info?
Comment 2 netizen 2022-11-25 09:23:25 UTC
(In reply to Kurt Hindenburg from comment #1)
> Can you provide more info?

Of course, but it is an edge use case. I've a full screen konsole running a tail -f on a service log, when I'm publishing changes I usually put it into search to highlight some strings, now I'm searching for :app, app:, push: and 3000: (a quite simple regex), and what I'd love to achieve is to exclude the colon chat from the highlight using a "non capture group" in the regex.
I know, I can and surely should, take my time to setup a custom grc config, as this FS Konsole has a dedicated monitor and is an important part of my job.
Comment 3 ninjalj 2022-11-25 10:40:47 UTC
That's not what non-capturing groups are for. What you need for your use-case are look-around assertions (http://pcre.org/current/doc/html/pcre2pattern.html#SEC20). E.g. to not include a trailing colon:

foo(?=:)

To not include a leading colon:

(?<=:)foo

or its alias:

:\Kfoo
Comment 4 netizen 2022-11-25 10:47:45 UTC
(In reply to ninjalj from comment #3)
> That's not what non-capturing groups are for. What you need for your
> use-case are look-around assertions
> (http://pcre.org/current/doc/html/pcre2pattern.html#SEC20). E.g. to not
> include a trailing colon:
> 
> foo(?=:)
> 
> To not include a leading colon:
> 
> (?<=:)foo
> 
> or its alias:
> 
> :\Kfoo

You're right, and it works! I'm sorry. I'm closing this