krasa / StringManipulation

IntelliJ plugin - https://plugins.jetbrains.com/plugin/2162
Apache License 2.0
694 stars 81 forks source link

Regex group matching support #218

Open koop-pa opened 10 months ago

koop-pa commented 10 months ago

This is not related to a problem but rather an improvement.

I use the plugin a lot for filtering down text by using the "Grep" functionality and use the Regex option for that quite a bit. As it stands right now I am able to always find the line or lines that contain the regex. Regex also supports "group capturing". While adding groups does not break anything it also does not change the result.

For example with the following two line as part of a much bigger text file: ^FO73,658^BY3^BCN,154,N,N,N,A^FDBLPM844701365726444255301100^FS

When using the following regex expressions: \^BC.*\^FD.*\^FS \^BC.*\^FD(.*)\^FS

The same result is given; the selection of the line. ^FO73,658^BY3^BCN,154,N,N,N,A^FDBLPM844701365726444255301100^FS

It would be nice that when one or more capturing group(s) exist that the contents from the group(s) would become the filtered text. So that the result of the second regex would result in: BLPM844701365726444255301100