use strict;
my $str = 'Software Loopback Interface 1
Microsoft 6to4 Adapter
WAN Miniport (IKEv2)
WAN Miniport (IP)
Microsoft IP-HTTPS Platform Adapter
WAN Miniport (GRE)
WAN Miniport (Network Monitor)
Microsoft Kernel Debug Network Adapter
Microsoft Failover Cluster Virtual Adapter
WAN Miniport (IPv6)
HPE Ethernet 1Gb 4-port 366FLR Adapter #4
Microsoft Teredo Tunneling Adapter
Microsoft Network Adapter Multiplexor Driver
HPE Ethernet 1Gb 4-port 366FLR Adapter
WAN Miniport (PPTP)
WAN Miniport (PPPOE)
WAN Miniport (SSTP)
HPE Ethernet 1Gb 4-port 366FLR Adapter #3
HPE Ethernet 1Gb 4-port 366FLR Adapter #2
WAN Miniport (L2TP)
Microsoft Failover Cluster Virtual Adapter-WFP Native MAC Layer LightWeight Filter-0000
Microsoft Failover Cluster Virtual Adapter-Npcap Packet Driver (NPCAP)-0000
Microsoft Failover Cluster Virtual Adapter-QoS Packet Scheduler-0000
Microsoft Failover Cluster Virtual Adapter-WFP 802.3 MAC Layer LightWeight Filter-0000
HPE Ethernet 1Gb 4-port 366FLR Adapter #3-WFP Native MAC Layer LightWeight Filter-0000
HPE Ethernet 1Gb 4-port 366FLR Adapter-WFP Native MAC Layer LightWeight Filter-0000
DB
Microsoft Network Adapter Multiplexor Driver-WFP Native MAC Layer LightWeight Filter-0000
Microsoft Network Adapter Multiplexor Driver-Microsoft Load Balancing/Failover Provider-0000
Microsoft Network Adapter Multiplexor Driver-Npcap Packet Driver (NPCAP)-0000
Microsoft Network Adapter Multiplexor Driver-QoS Packet Scheduler-0000
Microsoft Network Adapter Multiplexor Driver-WFP 802.3 MAC Layer LightWeight Filter-0000
WAN Miniport (IP)-WFP Native MAC Layer LightWeight Filter-0000
WAN Miniport (IP)-Npcap Packet Driver (NPCAP)-0000
WAN Miniport (IP)-QoS Packet Scheduler-0000
WAN Miniport (IPv6)-WFP Native MAC Layer LightWeight Filter-0000
WAN Miniport (IPv6)-Npcap Packet Driver (NPCAP)-0000
WAN Miniport (IPv6)-QoS Packet Scheduler-0000
WAN Miniport (Network Monitor)-WFP Native MAC Layer LightWeight Filter-0000
WAN Miniport (Network Monitor)-Npcap Packet Driver (NPCAP)-0000
WAN Miniport (Network Monitor)-QoS Packet Scheduler-0000
';
my $regex = qr/6to4|Teredo|Kernel\sDebug|WFP\sNative\sMAC|QoS\sPacket\sScheduler|WAN\sMiniport|Failover\sProvider|\s\-\sethernet_|LightWeight\sFilter|Npcap/mp;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
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 Perl, please visit: http://perldoc.perl.org/perlre.html