in reply to How to enforce match priority irrespective of string position
>> I need to specify a priority of match without regard to position.
Try look-ahead search. May this sketch give some help:
Upd.: I think my example (now striked-thourgh) simply reduces to the same but without look-ahead; see comment by Lanx.
Edit: removed text that caret is obsolete.$line =~ s/^ ( (?= .*? $regex_1 ) .*? $regex_1 #FIRST PRIORITY | (?= .*? $regex_2 ) .*? $regex_2 #SECOND PRIORITY ) /something/gmx;
Upd.: I think my example (now striked-thourgh) simply reduces to the same but without look-ahead; see comment by Lanx.
|
---|
In Section
Seekers of Perl Wisdom