Hello Programmers, In this post, you will know how to solve the HackerRank Negative Lookahead Solution. This problem is a part of the Regex HackerRank Series.HackerRank Negative Lookahead SolutionsOne more thing to add, don’t directly look for the solutions, first try to solve the problems of Hackerrank by yourself. If you find any difficulty after trying several times, then you can look for solutions.HackerRank Negative Lookahead Solutionregex_1(?!regex_2)The negative lookahead (?!) asserts regex_1 not to be immediately followed by regex_2. Lookahead is excluded from the match (do not consume matches of regex_2), but only assert whether a match is possible or not.TaskYou have a test String S.Write a regex which can match all characters which are not immediately followed by that same character.ExampleIf S = goooo, then regex should match goooo. Because the first g is not follwed by g and the last o is not followed by o.NoteThis is a regex only challenge. You are not required to write a code.You have to fill the regex pattern in the blank (_________).HackerRank Negative Lookahead Solutions in CppHackerRank Negative Lookahead Solutions in Javapublic class Solution { public static void main(String[] args) { Regex_Test tester = new Regex_Test(); tester.checker("(?!(\\S)\\1)(\\S)"); //Use '\\' instead of '\'. } }HackerRank Negative Lookahead Solutions in PythonRegex_Pattern = r"(.)(?!\1)" # Do not delete 'r'.HackerRank Negative Lookahead Solutions in JavaScriptvar Regex_Pattern = /(.)(?!\1)/g; //Do not delete `/` and `/g`.HackerRank Negative Lookahead Solutions in PHP$Regex_Pattern = '/(\D)(?!\1)/'; //Do not delete '/'. Replace __________ with your regex. Disclaimer: This problem (Negative Lookahead) is generated by HackerRank but the Solution is Provided by BrokenProgrammers. This tutorial is only for Educational and Learning purposes.Next: HackerRank Negative Lookbehind Solution Post navigationHackerRank Positive Lookahead Solution HackerRank Negative Lookbehind Solution