Non-UNIX Matching Method

The type of non-UNIX matching method is significant only when you use a find-and-replace command. “Matching method” refers to the technique used to match repeated expressions. For example, does the expression a* match as few or as many characters as it can? The answer depends on the matching method.

PWB supports two matching methods in non-UNIX regular expressions:

“Minimal matching” matches as few characters as possible to find a match. For example, a+ matches only the first character in aaaaa. However, ba+b matches the entire string baaaab because it is necessary to match every a to match both occurrences of b.

“Maximal matching” matches as many characters as possible. For example, a# matches the entire string aaaaaa.

Example

If a+ (minimal matching plus) is the find string and EE is the replacement string, PWB replaces aaaaa with EEEEEEEEEE because at each occurrence of a, PWB immediately replaces it with EE.

However, if a# (maximal matching plus) is the find string, PWB replaces the same string with EE because it matches the entire string aaaaa at once and replaces that string with EE.