Дима Попиль
Дима Попиль

Reputation: 11

PCRE exclude when word is in line

I have regex (#+.\d*\.\d) to catch expression like #1.0 #-1.0 #1.5 ... But I want to skip match if in line there is FCMP word

match this line

.text:00000000005A2F7C                 FMOV            D1, #1.0

skip this line

.text:00000000005A2F70                 FCMP            D0, #0.0

How can I do this?

Upvotes: 1

Views: 112

Answers (1)

Wiktor Stribiżew
Wiktor Stribiżew

Reputation: 626845

You may use

.*\bFCMP\b.*(*SKIP)(*F)|#-?\d*\.\d+

See the regex demo

Details

  • .*\bFCMP\b.*(*SKIP)(*F)| - a line (note the start and end of the line is matched with two .* patterns) containing a whole word FCMP (\bFCMP\b) that is matched and skipped (with (*SKIP)(*F))
  • #-?\d*\.\d+ - matches #, an optional -, then 0 or more digits, a dot and then 1 or more digits.

Upvotes: 1

Related Questions