use strict;
my $str = '@DethDeelinDale DALE BUB⁉️\\n\\nU ALRIT⁉️\\n\\nU NEED BAKUP⁉️
RT @DethDeelinDale: WHO N THE FUK R U #DIKS⁉️\\n\\nHOLEE FUK‼️ PUT DEM \\uD83D\\uDD2B AWAY!!!\\n\\nU kan hav the \\uD83D\\uDCB0 I dun giv a fuk bout dat!!!\\n\\nHear u go…jus ta…
@DethDeelinDale Waz rong dale⁉️\\n\\nWaz it a menshall er 1 a em lite \\uD83D\\uDEAC⁉️\\n\\nI dun HAYT thoz‼️\\n\\nNuthin but #MarbReds\\uD83D\\uDEAC 4 me‼️
WAT N THE FLYIN FUK⁉️\\n\\nHEY, U DUM B!TCH, PULL UP UR FN \\uD83D\\uDC56‼️\\n\\nU KANT NOT FRIGGEN \\uD83D\\uDCA9 HER‼️\\n\\nI swar 2 fn God, thez #ratards\\uD83E\\uDD24 @ friggen @Walmart r gonna dun mayk me looz mi fn mind!!! \\uD83E\\uDD2C\\uD83E\\uDD2C https://t.co/xsQg26SWIk
WOOD U HUREE THE FUK UP U STUPID LITLE KIDS N GET ON UR GOD DAM SKOOL \\uD83D\\uDE8C!!! \\uD83E\\uDD2C\\n\\nU MOTHAFUKERS R GONNA DUN MAYK ME LAYT AGAN 2 MI JOB #HAWLINKARTS\\uD83D\\uDED2 @Walmart‼️\\n\\nThas it! I aint not got Tim 4 this, Im passin thez fn ratards!!! \\uD83D\\uDCA8\\n\\nOhhhh fukkkkk... \\uD83D\\uDEA8\\uD83D\\uDE94\\uD83E\\uDD26\\uD83C\\uDFFB♂️\\uD83E\\uDD26\\uD83C\\uDFFB♂️
WAR N TYE FLYIN FUK M I N WAT HAPND 2 MI FN \\uD83D\\uDC56!!!???
@DethDeelinDale Wat 4 bub⁉️ U dun need mi #glock \\uD83D\\uDD2B???
RT @DethDeelinDale: I NEEDA #GAT \\uD83D\\uDD2B‼️
RT @DethDeelinDale: BOOOOOMMMMM‼️ \\n\\nDAS WAT I THOT #BALDYBILL \\uD83D\\uDC68\\uD83C\\uDFFB\\uD83E\\uDDB2‼️\\n\\nU cum talkin all dat SHIT 2 me n think u waznt gonna get put 2 fukin…
Hapins 2 the best a us! \\uD83D\\uDC56\\uD83D\\uDCA9 https://t.co/TVzch1v0du
RT @HistoryMuppet: This is a brilliant example of the Muppet team going that extra step with a gag \\uD83D\\uDE02\\n(look closely at those “Written By” cr…
RT @BroadwayWorld: .@MusicManBway will close on Broadway on January 1, 2023. https://t.co/8sMQ3LUsnA
RT @TWJSciNat: Are you feeling lucky? \\n\\nThe latest episode of Mysteries of Science, starring @DerrenBrown is now live. \\n\\n\\uD83D\\uDD17Listen at https:/…
RT @JustinRYoung: Very excited to finally release @DontExplainPod, the latest from @DogPonyAudio.\\n\\nEvery cliche and trope began as a brilli…
RT @Justin_Willman: People love me on holidays https://t.co/Ft1udKGydl
RT @BroadwaySym: Shana Tova! Wishing eveyone a sweet new year filled w/ many blessings in #stagemanagement & #smlife! May the year bring yo…
RT @memgrizz: #BeyondGrit: Making Magic w/ @jacob_laravia3 + @droddy22 \\uD83E\\uDE84 \\n\\nIn this episode, LaRavia & Roddy link up with Piff The Magic Dra…
RT @BroadwayWorld: Obituary: Rita Gardner, Original Luisa in THE FANTASTICKS, Passes Away at 87\\nhttps://t.co/GClzbN6Mii
Oh no! Broadway legend \\uD83D\\uDE22\\uD83D\\uDE22 RIP https://t.co/J7JXoEmEYZ
RT @levarburton: Happy Rosh Hashanah, y’all! #ShanaTova \\uD83D\\uDC9C\\uD83D\\uDE4F\\uD83C\\uDFFE
\\u@83D
\\u#123
\\u(223';
my $regex = qr`(\\\w\\\w)|(\\[u][A-Za-z0-9A@#\\(]{4})|([\\][n])`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