use strict;
my $str = 'Fri, Apr 21, 2023 7:49 AM 6ab4e8de-262b-4926-a12e-646863749f35 Fir#7634 (750565290009559112) HitByaThunder#1925 continuing to make giveaways after being told to stop. fir, stop if you\'re asked to Stop';
my $regex = qr/(?:(?P<Date>(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{1,2}, \d+ \d{1,2}:\d{1,2} AM|PM) (?P<WarnID>(?:[0-9a-f]|-)*) (?P<User>[a-zA-Z]+#[0-9]{4}) (?:\((?P<UserID>[0-9]+)\)) (?P<Moderator>[a-zA-Z]+#[0-9]{4}) (?P<WarnReason>(?:\s|\S)+))/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