I'm trying to use the find/"adding/removing string"/regular expression option in gitk. The syntaxes I have tried don't work, and I can find no docs that describe the syntax of the regular expressions it accepts.
I'm trying to match both Modem_Wakup
and Modem_UnWakeup
. Neither Modem_(Un)?Wakeup
nor
Modem_\(Un\)?Wakeup
, nor Modem_\(Un\)\?Wakeup
, nor any other obvious ones work. I can find the strings individually, so I know there should be matches.
So what syntax does it use?
$ means "Match the end of the string" (the position after the last character in the string). Both are called anchors and ensure that the entire string is matched instead of just a substring.
The plus sign + is a greedy quantifier, which means one or more times. For example, expression X+ matches one or more X characters. Therefore, the regular expression \s matches a single whitespace character, while \s+ will match one or more whitespace characters.
private final String REGEX = "\\d"; // a single digit. In this example \d is the regular expression; the extra backslash is required for the code to compile.
A regular expression is a pattern that could be matched against an input text. The . Net framework provides a regular expression engine that allows such matching. A pattern consists of one or more character literals, operators, or constructs.
This feature should be based on the pickaxe grep system, based on POSIX regexp.
But this thread reports some bug around this from gitk:
I presented the issue to #git, and it was suggested that it is probably a pickaxe bug in that it doesn't display changes in merge commits if they add strings that neither of their parents has.
This may not be your exact case though, simply an illustration that the feature isn't fully available yet.
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