Question

using java String Challenge Have the function StringChallenge(str) read str which will contain two strings...

Have the function wildcard(str) read str which will contain two strings separated by a space.

The first string will consist of the following sets of characters: +, *, $ and {N} which is optional.

The plus (+) character represents a single alphabetic character, the ($) character represents a

number between 1-9, and asterisk (*) represents a sequence of the same character of length 3

unless it is followed by {N} which represents how many characters would appear in the

sequence where N will be at least 1. Your goal is to determine if the second string exactly

matches the pattern of the first string in the input.


For example: if str is “++*{5} jtggggg” then the second string in this case does match the

pattern, so your program should return true. If the second string does not match the pattern

your program should return false.


Examples

1. Input: +++++* abcdehhhhhh

Output: false

2. Input: $**+*{2} 9mmmrrrkbb

Output: true


0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
using java String Challenge Have the function StringChallenge(str) read str which will contain two strings...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • using c language String Challenge Have the function StringChallenge(str) read str which will contain two strings...

    using c language String Challenge Have the function StringChallenge(str) read str which will contain two strings separated by a space. The first string will consist of the following sets of characters: +, *, $, and {N} which is optional. The plus (+) character represents a single alphabetic character, the ($) character represents a number between 1-9, and the asterisk (*) represents a sequence of the same character of length 3 unless it is followed by {N} which represents how many...

  • USING RECURSION ONLY...NO ITERATION Write a module called advancedmatch.py recursive function called ‘match(pattern, word)’ that can...

    USING RECURSION ONLY...NO ITERATION Write a module called advancedmatch.py recursive function called ‘match(pattern, word)’ that can be used to determine if a given pattern matches a given word. In this case, a pattern consists of letters and ‘?’ and ‘*’ wildcards. A ‘?’ wildcard matches any letter at the corresponding position in the word. A ‘*’ wildcard matches zero or more letters at the corresponding position in the word. Use aprogram called testadvanced.py that can be used to check your...

  • In Java, write a program that prompts the user to input a sequence of characters and...

    In Java, write a program that prompts the user to input a sequence of characters and outputs the number of vowels. You will need to write a method to return a value called isAVowel which will return true if a given character is a vowel and returns false if the character is not a vowel. A second method, called isAConstant, should return true if a given character is a constant and return false if the character is not a constant....

  • JAVA Your task is to implement a simple pattern-matching method. The method is supplied a pattern...

    JAVA Your task is to implement a simple pattern-matching method. The method is supplied a pattern to find (the “needle”) and a text to search (the “haystack”). The pattern will be a sequence of characters and, optionally, one or more dashes (-). A dash represents a wildcard, which matches any character. The method needs to return an array of all substrings of the haystack that matches the needle pattern – all characters are the same, or the pattern character is...

  • Write a program that can remove spaces from an input string, find the indexes of a...

    Write a program that can remove spaces from an input string, find the indexes of a character within the string and replace that character with another character. Here is an example input: I am an input string a b The first line, "I am an input string" represents the input string. Please put it into a string variable using getline. In the second line "a b", a is the character that needs to be located within the input string, and...

  • PLEASE USE MATLAB This is a basic problem that illustrates the concept of strings. A palidrome...

    PLEASE USE MATLAB This is a basic problem that illustrates the concept of strings. A palidrome is a string of characters that is read the same forwards as it is backwards. For example, racecar' is a palindrome; reversing the order of the characters leaves the string unchanged. Write a otherwise. function called isPalindrome that accepts one input and returns one output. The input str is a string of characters, and the output is 1 if str is a palindrome, For...

  • Write a method in java named isValidEmail that takes a string as input parameter, and returns...

    Write a method in java named isValidEmail that takes a string as input parameter, and returns true if that string represents a valid email address, or false otherwise. An email address is considered valid if it follows this format “[email protected]”, where:  user123 represents a sequence of word characters (i.e., letters, digits, or underscore) whose length is between 1 and 10 (inclusive), but the first character must be a letter  domain represents a sequence of alphanumeric characters (i.e., letters...

  • Write a program that replace repeated three characters in a string by the character followed by 3...

    Write a program that replace repeated three characters in a string by the character followed by 3. For example, the string aabccccaaabbbbcc would become aabc3ca3b3cc. When there are more than three repeated characters, the first three characters will be replaced by the character followed by 3. You can assume the string has only lowercase letters (a-z). Your program should include the following function: void replace(char *str, char *replaced); Your program should include the following function: void replace(char *str, char *replaced);...

  • Task Algorithms: Pattern Matching (in java) Write a program that gets two strings from user, size...

    Task Algorithms: Pattern Matching (in java) Write a program that gets two strings from user, size and pattern, and checks if pattern exists inside size, if it exists then program returns index of first character of pattern inside size, otherwise it returns -1. The method should not use built-in methods such as indexOf , find, etc. Only charAt and length are allowed to use. Analyze the time complexity of your algorithm. Your solution is not allowed to be> = O...

  • Please read the problem carefully and answer the 2 questions below code: /***************************************************************** * Program: palindrome.c...

    Please read the problem carefully and answer the 2 questions below code: /***************************************************************** * Program: palindrome.c * * Purpose: implements a recursive function for determining *   if a string is a palindrome * * Authors: Steven R. Vegdahl, Tammy VanDeGrift, Martin Cenek * *****************************************************************/ #include #include #include /***************************************************************** * is_palindrome - determines whether a string of characters is a palindrome * * calling sequence: *    result = is_palindrome(str, first_index, last_index) * * parameters - *    str - the string to test *    first_index -...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT