You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import Foundation
letregex=/(?m)^\b.*(^(?!SERIAL|TT).+)/letstring="""CONT NEG TESTS - ALL PINSSERIAL NUMBER: 15 MODULE: 0 Mon Jan 1 03:41:42 2007TT STMT PIN MEAS VALUE FORCING LESS THAN GREATER THAN---- ---- --- --------------- --------------- ---------- ------------"""formatchin string.matches(of: regex){print(match.output.1)}print("")print(string.firstMatch(of: regex)?.output.1??"")
Expected output:
CONT NEG TESTS - ALL PINS
CONT NEG TESTS - ALL PINS
Actual output:
CONT NEG TESTS - ALL PINS
---- ---- --- --------------- --------------- ---------- ------------
CONT NEG TESTS - ALL PINS
While removing multiline fixes it, this is only one capture group of a larger regex; and it works as expected, with multiline, in both Java (on my local machine) and the PCRE2 flavor on Regex101.com.