$re = '/^(?=Nokia.*|Oppo.*|Huawei.*|Xiaomi.*).*/mi';
$str = 'iPhone 7 Plus
iPad Pro 12.9 2015 iOS15.5 beta 4
Xiaomi Pocophone F1
Google Pixel 4 XL
Samsung Galaxy S22 Plus 5G
Samsung Galaxy Tab A 9.7
iPhone 11 Pro iOS15.5 beta4
iPad Pro 10.5 2017
Samsung Tab E
Huawei Y9 2019
iPad 9.7 2018 iOS15.5 beta4
Samsung Galaxy Tab S8
iPhone X
iPhone 11 Pro Max
Samsung Tab E 9.6
Samsung Galaxy S8
Google Pixel 2
Samsung Galaxy A10
Samsung Galaxy A51
LG Q6
Huawei P9
iPad Pro 10.5 2017
Samsung Galaxy A71 5G
ZTE Axon 7
iPad mini 3
iPhone X
Samsung Galaxy S20 Ultra
2iPad Pro 12.9 2021
LG Q Stylo 4
Moto Z2 Force
Samsung Galaxy S21 5G
iPhone 13
ZTE Axon 7
Google Pixel 3a XL
Samsung Galaxy S6 Edge
iPhone 11
iPhone 12 mini
Sony Xperia XZ
iPad Pro 12.9 2018
OnePlus 9 Pro
Samsung Galaxy S8+
iPad Pro 11 2018
iPhone 12
Samsung Galaxy Note 20 Ultra 5G
LG V30
Motorola Moto Z
OnePlus 5T
Samsung Galaxy S6 Edge
Samsung Galaxy M20
OnePlus 9
iPhone X iOS15.5 beta4
Samsung Galaxy A02
iPad Air 2
Samsung Galaxy S7
iPhone 8
Mason D450B
iPhone 6
iPhone XS Max
iPad mini 4
Samsung Galaxy S22 5G
iPad Air 3 (2019)
Google Pixel 4a
Samsung Galaxy Tab A 10.1 2016
Samsung Galaxy Note 8
iPhone SE 2020
Asus Google Nexus 7 (2013)
iPhone 11 Pro
Samsung Galaxy A30
Google Pixel 4 XL
iPhone 12 Pro
iPad Mini 2019
Vivo X21
iPad 9.7 2018
iPad 10.2 2020
Samsung Galaxy S10e
iPhone SE
iPad Air 2
iPad Air 2022 5th Gen
iPad Air 2020
Samsung Galaxy S10
Samsung Galaxy S21 Plus 5G
OnePlus Nord N200 5G
iPad Air 2
Google Pixel 4 XL
Samsung Galaxy A9 2018
Samsung Galaxy A51
Motorola Moto G Stylus 2021
Google Pixel 4
Huawei Honor 9
Samsung Galaxy S6 Edge+
Samsung Galaxy A20e
iPad Pro 11 2021
iPhone SE 2020
Mason G450A1
Xiaomi Mi MIX 2
Samsung Galaxy Tab A7
iPhone 6 Plus
iPad Pro 11 2020
iPad 10.2 2020
Google Pixel 5a
Google Pixel 6 Pro
Samsung Galaxy A21
Samsung Galaxy Note 20 5G
iPad Pro 10.5 2017
HTC One A9
Huawei Honor 8
Samsung Galaxy S6 Edge+
Google Pixel 2 XL
iPad 10.2
iPhone XR
Samsung Galaxy S8+
Nokia 7.1
Samsung Galaxy S20 Plus
Samsung Galaxy A3 2017
LG K10
HTC Desire 12
iPad Pro 12.9 2015
Samsung Galaxy A5 (2017)
Huawei P30 Lite
LG V40
OnePlus 6T
iPad Pro
iPad Air 2
Google Pixel 3 XL
iPhone 7
Google Pixel C
iPad Mini 2021 6th Gen
Motorola Moto G5 Plus
iPad Air 2020
Samsung Galaxy S20
iPhone 8 Plus
Samsung Galaxy A31
Google Pixel 3
Sony Z5 Premium
Sony Xperia Z1
LG Phoenix 2
iPhone 11
iPad 9.7 2017 5th Gen
iPhone XS
Samsung Galaxy Tab S6
Samsung Galaxy J7 2016
Honeywell CK65
Samsung Galaxy A5
HTC 10
iPad Pro 12.9 2020
Sony Xperia 10
Google Pixel 3a XL
iPhone 6S
Sony Xperia 5
iPad Air
Samsung Galaxy A6 2018
Samsung Galaxy S9
Samsung Galaxy S5
Google Pixel XL
LG G7 Thinq
Motorola Moto X Play
Huawei P30 Lite
iPhone XS Max
Samsung Galaxy S10+
Samsung Galaxy Tab S2
Samsung Galaxy Tab S8 Plus
iPhone SE 2020
LG K30
LG V30+ Thinq
iPhone_11_Pro
Samsung Galaxy A80
OnePlus 3T
iPhone 5S
Samsung Galaxy S22 Ultra 5G
iPhone 8
iPhone 7 Plus
iPod Touch 6
iPad Pro 9.7
Huawei Mate 9
Samsung Galaxy Note 20 Ultra 5G
OnePlus 3
iPhone 12 mini iOS15.5 beta4
OnePlus 7 Pro
Nokia 8
Samsung Galaxy Z Fold 2 5G
OnePlus 6
Samsung Galaxy Tab S5e
Samsung Galaxy A50
iPhone X
iPhone 8
Samsung Galaxy S21 Ultra 5G
LG Stylo 6
Google Pixel 3
iPhone 6
iPhone X
iPhone 13 Pro Max
iPhone 12 Pro Max
Sony Xperia Z3 Compact
Xiaomi MI 6
LG V20
iPad Air 2 iOS15.5 beta4
Google Pixel 5
Motorola Moto G Power (2021)
Lenovo Tab 3 Pro
Motorola Moto G6
Essential PH-1
Samsung Galaxy Note 9
iPhone 6
iPad mini 4
Samsung Galaxy S10e
Samsung Galaxy A8 2018
Samsung Galaxy A10e
iPad Pro 11 2018
iPad Pro 12.9 2015
Samsung Galaxy Note 5
Samsung Galaxy Fold 5G
iPhone XR
iPhone XS
Samsung Galaxy Note 4
Samsung Galaxy S21 5G
Samsung Galaxy Tab S7
Motorola One Vision
Samsung Galaxy Note 10+
iPhone XR
LG G8 ThinQ
Amazon Kindle Fire HD 8
iPhone 7
iPad Pro 12.9 2017
Motorola Moto G7
Samsung Galaxy Tab S7 Plus
iPhone 8
Samsung Galaxy Z Flip
iPhone 6S
LG G6
Samsung Galaxy S7 Edge
Samsung Galaxy Tab S8 Ultra
Google Pixel 6 Pro
Huawei P10
Huawei P20
Samsung Galaxy Note 5
OnePlus 8 Pro
Amazon Kindle Fire HD 8 (2020)
Samsung Galaxy S6
iPad Pro 12.9 2017
Xiaomi Redmi Note 9
Motorola Nexus 6
Motorola Moto G6 Plus
Vivo V9
iPad Pro 12.9
iPhone X
iPhone 8 Plus
iPad Air 3 (2019)
Samsung Galaxy Tab S4
iPhone 8
Samsung Galaxy S10
Motorola Moto X (2nd gen)
iPhone 12 Pro Max
Amazon Kindle Fire HD 10 (2019)
OnePlus 7T
iPad Pro 12.9 2015
OnePlus 8
iPad mini 4
iPhone 13 mini
iPad Air 2
iPhone 13 Pro
Samsung Galaxy Xcover 3
Xiaomi Redmi 9
iPhone 7
Sony Xperia XZ1
iPhone XS
ZTE Blade V7 lite
Huawei P30 Pro
iPad 10.2 2021 9th Gen
Samsung Galaxy Tab S4 10.5
iPhone SE 2020
iPod Touch 7
iPad Air 2
Google Pixel 6
Amazon Kindle Fire HD 7
iPhone 7 Plus
iPhone SE 2022
Huawei P20 Pro
Motorola Moto Z Play
Huawei Mate 10 Pro
iPhone 6S Plus
OnePlus 5
Google Pixel 3 XL
Google Pixel 3a
iPhone 12
Samsung Galaxy Note 10
Samsung Galaxy Tab S3';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php