[HackerRank][Regex]

728x90




■  Positive Lookbehind
■  Split the Phone Numbers

■  Matching Same Text Again & Again


■  Negative Lookbehind


■  HackerRank Tweets

■  Utopian Identification Number
■  Negative Lookahead
■  Find HackerRank

■  Saying Hi



■  Build a Stack Exchange Scraper

■  Detecting Valid Latitude and Longitude Pairs
■  Alien Username
■  Branch Reset Groups
■  Backreferences To Failed Groups
■  The British and American Style of Spelling
■  Detect HTML Attributes

■  Valid PAN format
■  Detect HTML Tags
■  HackerRank Language
■  IP Address Validation
■  UK and US: Part 2
■  Find A Sub-Word
■  Forward References

 

■  Positive Lookahead
99.41%
 
 
 
 
■  Matching Word & Non-Word Character
98.72%
 
■  Positive Lookbehind
98.46%
 
■  Split the Phone Numbers
98.09%
 
■  Matching Whitespace & Non-Whitespace Character
98.04%
 
■  Matching Same Text Again & Again
97.91%
 
■  Excluding Specific Characters
97.91%
 
■  Matching {x, y} Repetitions
97.87%
 
■  Negative Lookbehind
97.87%
 
■  Matching Start & End
97.64%
 
■  Matching Digits & Non-Digit Characters
97.35%
 
■  HackerRank Tweets
97.33%
 
■  Matching Ending Items
97.30%
 
■  Utopian Identification Number
97.15%
 
■  Negative Lookahead
97.09%
 
■  Find HackerRank
97.09%
 
■  Matching Word Boundaries
96.97%
 
■  Saying Hi
96.96%
 
■  Matching Specific Characters
96.41%
 
■  Matching Character Ranges
96.37%
 
■  Matching Specific String
96.11%
 
■  Build a Stack Exchange Scraper
95.83%
 
■  Matching {x} Repetitions
95.70%
 
Detecting Valid Latitude and Longitude Pairs
95.59%
 
Alien Username
95.45%
 
Branch Reset Groups
95.22%
 
Backreferences To Failed Groups
94.71%
 
The British and American Style of Spelling
94.40%
 
Detect HTML Attributes
94.34%
 
Alternative Matching
94.21%
 
Valid PAN format
93.68%
 
Detect HTML Tags
93.54%
 
HackerRank Language
92.81%
 
IP Address Validation
91.62%
 
UK and US: Part 2
91.50%
 
Find A Sub-Word
90.70%
 
Forward References
89.56%
 
Matching Anything But a Newline
83.71%
 
 
[HackerRank][Regex] Matching One Or More Repetitions
99.45%
 
[HackerRank][Regex] Positive Lookahead
99.41%
 
[HackerRank][Regex] Capturing & Non-Capturing Groups
98.97%
 
[HackerRank][Regex] Matching Zero Or More Repetitions
98.96%
 
[HackerRank][Regex] Matching Word & Non-Word Character
98.72%
 
[HackerRank][Regex] Positive Lookbehind
98.46%
 
[HackerRank][Regex] Split the Phone Numbers
98.09%
 
[HackerRank][Regex] Matching Whitespace & Non-Whitespace Character
98.04%
 
[HackerRank][Regex] Matching Same Text Again & Again
97.91%
 
Excluding Specific Characters
97.91%
 
Matching {x, y} Repetitions
97.87%
 
Negative Lookbehind
97.87%
 
Matching Start & End
97.64%
 
Matching Digits & Non-Digit Characters
97.35%
 
HackerRank Tweets
97.33%
 
Matching Ending Items
97.30%
 
Utopian Identification Number
97.15%
 
Negative Lookahead
97.09%
 
Find HackerRank
97.09%
 
Matching Word Boundaries
96.97%
 
Saying Hi
96.96%
 
Matching Specific Characters
96.41%
 
Matching Character Ranges
96.37%
 
Matching Specific String
96.11%
 
Build a Stack Exchange Scraper
95.83%
 
Matching {x} Repetitions
95.70%
 
Detecting Valid Latitude and Longitude Pairs
95.59%
 
Alien Username
95.45%
 
Branch Reset Groups
95.22%
 
Backreferences To Failed Groups
94.71%
 
The British and American Style of Spelling
94.40%
 
Detect HTML Attributes
94.34%
 
Alternative Matching
94.21%
 
Valid PAN format
93.68%
 
Detect HTML Tags
93.54%
 
HackerRank Language
92.81%
 
IP Address Validation
91.62%
 
UK and US: Part 2
91.50%
 
Find A Sub-Word
90.70%
 
Forward References
89.56%
 
Matching Anything But a Newline
83.71%

 

import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {    

    public static void main(String[] args) {
        
        Regex_Test tester = new Regex_Test();
        tester.checker("__________"); // Use \\ instead of using \ 
    
    }
}

class Regex_Test {

    public void checker(String Regex_Pattern){
    
        Scanner Input = new Scanner(System.in);
        String Test_String = Input.nextLine();
        Pattern p = Pattern.compile(Regex_Pattern);
        Matcher m = p.matcher(Test_String);
        System.out.println(m.find());
    }   
    
}
var Regex_Pattern = /__________/; //Do not delete '/'. Replace __________ with your regex.

function processData(Test_String) {
    //Enter your code here
    
    console.log(!!Test_String.match(Regex_Pattern));
} 

process.stdin.resume();
process.stdin.setEncoding("ascii");
_input = "";
process.stdin.on("data", function (input) {
    _input += input;
});

process.stdin.on("end", function () {
   processData(_input);
});

 

 

반응형