In the Boyer-Moore algorithm, you begin to compare pattern characters with text characters from the end of the picture. If you find a mismatch, you have a type configuration
....xyzabc.... <-text ....uabc <- pattern ^ mismatch
Now shifting a bad symbol means shifting the template so that the text mismatch symbol is aligned with the last occurrence of this symbol in the initial part of the template (template minus the last symbol of the template) if there is such an occurrence or one position before the template if the inconsistent character is not displayed at all in the initial part of the template.
It could be a left shift if the situation
v ...xyzazc... ....uazc ..uazc
so one does not guarantee progress.
Another shift, a good suffix shift, aligns the matched part of the text m with the smallest occurrence of this sequence of characters in the pattern, preceded by a different character (including none if the matched suffix is also the pattern prefix) than the matching suffix m pattern - if there is such event.
So for example
v ....abcdabceabcfabc... ...xabcfabcfabc ...xabcfabcfabc
will lead to a good shift suffix for four positions, since the corresponding part m = abcfabc is found in the template in four places to the left of its appearance suffix and is preceded by a different character ( x instead of f ) than in the suffix position.
If there is no complete match in the pattern preceding a character other than the suffix, a good shift of the suffix aligns the suffix of the agreed part of the text with the pattern prefix, selects the maximum overlap, for example,
v ...robocab.... abacab abacab
A good suffix shift always shifts the pattern to the right, so it guarantees progress.
Then, at each mismatch, the achievement of the bad character shift and the good suffix shift are compared, and the more chosen. This is explained in more detail by Christian Charras and Thierry Lecrock here , as well as many other string search algorithms.
For the example mentioned in the comments,
SSIMPLE EXAMPLE EXAMPLE ^
the matched suffix is MPLE , and the inconsistent text character is I Thus, a bad character shift searches for the last occurrence of I in the initial part of the pattern. This is not so, so a bad character shift would shift the pattern so that the irrelevant I was one before the start of the pattern
SSIMPLE EXAMPLE EXAMPLE
and a good suffix shift looks for the right-most appearance of MPLE in a template that is not preceded by A , or the longest suffix of MPLE , which is the template prefix. There is no complete appearance of the matched part in the pattern before the suffix, therefore the longest suffix of the matched part, which is also the template prefix, defines a good shift of the suffix. In this case, the two suffixes of the matched part, which are the template prefixes, are a one-character string E and an empty string. The longest, obviously non-empty line, so a good shift of the suffix aligns the one-character suffix E in the agreed part of the text with the one-character prefix of the template
SSIMPLE EXAMPLE EXAMPLE
A good suffix shift moves the pattern further to the right, so this is the selected shift.
Then there is an immediate mismatch at the last position of the pattern, and then an incorrect character shift aligns P in the text with P in the template (and a good suffix shift should not be considered at all if the mismatch occurs with the last character of the template, since in this case it will never produce a larger shift than shift of bad character).
Then we have full compliance.
In the TXAMPLE pattern TXAMPLE good suffix shift reveals that the non-empty suffix of the matched part is the pattern prefix (and there is no occurrence of the full matched part in the pattern not preceding A ), so a good suffix shift aligns the empty suffix of the matched part of the text (border between E and space ) with an empty template prefix (an empty string preceding T ), resulting in
SSIMPLE EXAMPLE TXAMPLE
(then, in the next step, the shift of bad characters aligns two L s, and the next mismatch at this stage occurs in the initial T pattern).