[ < < < Home ]
[ < < Reference Start ]
[ < Reference Contents ]
[ < Previous=PDGREPPE Expression Parts ]
[ Next=PDGREPPE Groups > ]
An operator is a way of dealing with something. In this case, it is a logical OR or logical AND Boolean operator. A Boolean operator is a way of evaluating one or more expressions for being True (|) or False (O). TRUTH TABLES for OR and AND Operators show what result (True or False) is obtained for two or more ME's. A "|" represents True. A "O" represents False. OR Truth Table ME0 | ME1 Result O O False O | TRUE | O TRUE | | TRUE AND Truth Table ME0 & ME1 Result O O False O | False | O False | | TRUE OR Operations: | OR ME0|ME1 : ME0 Or ME1 is in same area (Greatest width) ~ OR ME0~ME1 : ME0 Or ME1 is in same area (Shortest width) An OR operation is TRUE if ME0 *** OR *** ME1 is TRUE. An OR operation is FALSE if both ME0 *** AND *** ME1 are FALSE. Important: Also, since pattern matching in a OR/AND Group happens in direct CONTEXT to the remainder of the pattern to be matched: An OR operation "ME0 OR ME1" is TRUE providing that ME0 *** OR *** ME1 is TRUE AND the remainder of the pattern also PASSES beyond a successful match to ME0 and/or ME1. An OR operation "ME0 OR ME1" is FALSE if the pattern after a successful match to ME0 or ME1 is FALSE. TRUTH TABLES for OR and AND Operators show what result (True or False symbolised by | or O) is obtained for two or more ME's. OR Truth Table ME0 | ME1 Result O O False O | TRUE | O TRUE | | TRUE If TRUE, the longest ME found becomes part of the matched area. The OR operator is used to test 2 possible patterns for at least one of the patterns matching in the same area. The pattern <ME0> is tested against the current area and then the pattern <ME1> is tested in the same area. The match returned will be the one with the GREATEST width if using the regular OR of "|". Otherwise with "~", it is match with the SHORTEST width. And importantly, the match returned will be the one that passes any remainder of the pattern beyond the OR group. pdgreppe -Hjc "MAGIC|fixed" file_id.diz ...OR "|" in "MAGIC|fixed" finds lines in file_id.diz that have string "MAGIC" OR "fixed". pdgreppe -Hjc "MAGIC|MA" file_id.diz ...WIDEST OR "|" in "MAGIC|MA" finds lines in file_id.diz that have string "MAGIC" OR "MA" with the WIDEST of the matches shown as the result. pdgreppe -Hjc "MAGIC~MA" file_id.diz ...THINNEST OR as "~" in "MAGIC~MA" finds lines in file_id.diz that have string "MAGIC" OR "MA" with the THINNEST of the matches shown as the result. AND Operations: & AND ME0&ME1 : ME0 And ME1 are in SAME area An AND operation is TRUE if ME0 and ME1 are TRUE. An AND operation is FALSE if ME0 or ME1 are FALSE. AND Truth Table ME0 & ME1 Result O O False O | False | O False | | TRUE If TRUE, the area shared becomes part of the matched area. Also if TRUE : ME0 and ME1 have the SAME MATCH WIDTH. The AND operator is used to test 2 possible patterns BOTH matching in the same area and having the SAME WIDTH. The pattern <ME0> is tested against the current area and if it does match then the pattern <ME1> is tested in the same area. pdgreppe -Hjc "^.*Search.*&^.*pattern.*" file_id.diz ...AND "&" in "^.*Search.*&^.*pattern.*" finds any line in file_id.diz with strings "Search" AND "pattern". Combinations of OR/AND sequences Results for combinations of OR/AND sequences take on final result values from left to right. The OR and AND operators are of equal precedence and evaluate left to right. For example: A|B&C is evaluated left-to-right like a section {A|B} then <whatever {A|B}'s result was> & C. Or a pattern A&B|C is evaluated left-to-right like a section {A&B} then <whatever {A&B}'s result was> | C. Here are Truth Tables for combinations of OR/AND sequences: Truth Table(ME0|ME1&ME2) ME0 | ME1 & ME2 Result O O O False O O | False O | O False O | | TRUE | O O False | O | TRUE | | O False | | | TRUE Truth Table(ME0&ME1|ME2) ME0 & ME1 | ME2 Result O O O False O O | TRUE O | O False O | | TRUE | O O False | O | TRUE | | O TRUE | | | TRUE See also: CutBefore ":b" and CutAfter ":a" effects in Controls. Marked Group data match values "%<n>" or "%<VName>" for matching to previous found areas are CONSEQUTIVE and CUMULATIVE when being evaluated by OR/AND sequences. So patterns like .*(body).*&.*(loves).* or .*(body).*|.*(loves).* will have both of the marked groups for (body) and/or (loves) counted as passes. They will reference areas for a data string like Everybody loves somebody sometime. So if further search or substitution references are made to these as %0 or %1 then the areas are both available. NOTE: When searching for SOF (`) or EOF (') Start or End of File or other Zero_Width positions in OR/AND operations, these will be part of any width matched. The Shortest OR operator (~) can locate any of these, except EOF: A Zero_Width EOF (`) OR/AND term cannot be located separate from any other match that occurs at the End of File.
[ < < < Home ]
[ < < Reference Start ]
[ < Reference Contents ]
[ < Previous=PDGREPPE Expression Parts ]
[ Next=PDGREPPE Groups > ]
© Intelligence Services 1987 - 2008
GPO Box 9, ADELAIDE SA 5001, AUSTRALIA
EMAIL : intlsvs@gmail.com