import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "(\\\\\\w\\\\\\w)|(\\\\[u][A-Za-z0-9A@#\\\\(]{4})|([\\\\][n])";
final String string = "@DethDeelinDale DALE BUB⁉️\\n\\nU ALRIT⁉️\\n\\nU NEED BAKUP⁉️\n"
+ "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…\n"
+ "@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‼️\n"
+ "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\n"
+ "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♂️\n"
+ "WAR N TYE FLYIN FUK M I N WAT HAPND 2 MI FN \\uD83D\\uDC56!!!???\n"
+ "@DethDeelinDale Wat 4 bub⁉️ U dun need mi #glock \\uD83D\\uDD2B???\n"
+ "RT @DethDeelinDale: I NEEDA #GAT \\uD83D\\uDD2B‼️\n"
+ "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…\n"
+ "Hapins 2 the best a us! \\uD83D\\uDC56\\uD83D\\uDCA9 https://t.co/TVzch1v0du\n"
+ "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…\n"
+ "RT @BroadwayWorld: .@MusicManBway will close on Broadway on January 1, 2023. https://t.co/8sMQ3LUsnA\n"
+ "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:/…\n"
+ "RT @JustinRYoung: Very excited to finally release @DontExplainPod, the latest from @DogPonyAudio.\\n\\nEvery cliche and trope began as a brilli…\n"
+ "RT @Justin_Willman: People love me on holidays https://t.co/Ft1udKGydl\n"
+ "RT @BroadwaySym: Shana Tova! Wishing eveyone a sweet new year filled w/ many blessings in #stagemanagement & #smlife! May the year bring yo…\n"
+ "RT @memgrizz: #BeyondGrit: Making Magic w/ @jacob_laravia3 + @droddy22 \\uD83E\\uDE84 \\n\\nIn this episode, LaRavia & Roddy link up with Piff The Magic Dra…\n"
+ "RT @BroadwayWorld: Obituary: Rita Gardner, Original Luisa in THE FANTASTICKS, Passes Away at 87\\nhttps://t.co/GClzbN6Mii\n"
+ "Oh no! Broadway legend \\uD83D\\uDE22\\uD83D\\uDE22 RIP https://t.co/J7JXoEmEYZ\n"
+ "RT @levarburton: Happy Rosh Hashanah, y’all! #ShanaTova \\uD83D\\uDC9C\\uD83D\\uDE4F\\uD83C\\uDFFE\n\n"
+ "\\u@83D \n"
+ "\\u#123 \n"
+ "\\u(223";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
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 Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html