Posts

Showing posts from January, 2021

Elon Musk

 https://www.youtube.com/watch?v=GVum_R9DQ3I https://www.youtube.com/watch?v=OlP9623gfN0&ab_channel=ProvokeTributes

IMP

import java.util.regex.Matcher; import java.util.regex.Pattern; public class Sort { public Sort(String sentence)  { String questions = "(what |when |why |which |who |how |whose |whom |where )"; String helpingVerbs = "(is |am |are |was |were |being |been |be |have |has |had |do |does |did |will |would |shall |should |may |might |must |can |could )"; String normalPersons = "(i |me |my |mine |he |she |it |his |her |its |we |us |our |ours |they |them |their |theirs)"; String devicePersons = "(you |your |yours)"; String unknown = "((([a-zA-Z\\s]+)?+)?|([a-zA-Z\\s]+)?)?"; String regexToSearch = unknown + questions + helpingVerbs + normalPersons+ unknown; String regexToMe = unknown + questions + helpingVerbs + devicePersons+ unknown; Pattern checkRegex = Pattern.compile(regexToSearch); Matcher regexMatcher = checkRegex.matcher(sentence); if(sentence.matches(regexToSearch))  { System.out.prin...