Question: CODE MUST BE IN C, NOT C++ Filtering a string to remove escapes and find wildcards. In some string comparisons algorithms, the '.' character is

CODE MUST BE IN C, NOT C++

Filtering a string to remove escapes and find wildcards. In some string comparisons algorithms, the '.' character is a wildcard and allows any character to match that position in the string. However, if the '.' should not be interpreted as a wildcard, then it is proceeded by the escape character '\'. For example, "Clems.n" is used to find a string that matches all the letters except any character can appear in the position of the wildcard. But, the pattern "a\.b" means match the exact pattern "a.b" without allowing a wildcard substitution. The '\' is considered an escape character, and is used to indicate that the next character is not a special symbol but instead is a plain character. So, "a\\b" is treated as "a\b". For example, a "\." pattern is not a wildcard because of the escape character. The pattern "\\." does have a wildcard because the first '\' is an escape character but the second '\' is not. Write a program that prompts a user for an input string. Then, copy the input string to an output string called answer and remove the escape characters. Also, print the positions where the wildcards are found in the output string. Assume the input string is always less than 79 characters.CODE MUST BE IN C, NOT C++ Filtering a string to remove

2. (35 pts) Filtering a string to remove escapes and find wildcards. In some string comparisons algorithms, the character is a wildcard and allows any character to match that position in the string. However, if the '. ' should not be interpreted as a wildcard, then it is proceeded by the escape character 'l'. For example, "Clems.n" is used to find a string that matches all the letters except any character can appear in the position of the wildcard. But, the pattern "al.b" means match the exact pattern "a.b" without allowing a wildcard substitution. The 'l' is considered an escape character, and is used to indicate that the next character is not a special symbol but instead is a plain character. So, "al\b" is treated as "a\b". For example, a "\." pattern is not a wildcard because of the escape character. The pattern "\\." does have a wildcard because the first ''' is an escape character but the second '\' is not. Write a program that prompts a user for an input string. Then, copy the input string to an output string called answer and remove the escape characters. Also, print the positions where the wildcards are found in the output string. Assume the input string is always less than 79 characters. For example, if the input is: Input> cl.ms .n \f. \. tbal\1 Your code must print: Wildcard in position 2 Wildcard in position 9 Final string is: cl.ms.n\f.. tball Notice the escape characters have been removed and the '.'s in positions 5 and 10 of the final string are not wildcards. int main(void) { char text [80], answer [80]; int count = 0; printf ("Input> "); fgets (text, sizeof(text), stdin); 2. (35 pts) Filtering a string to remove escapes and find wildcards. In some string comparisons algorithms, the character is a wildcard and allows any character to match that position in the string. However, if the '. ' should not be interpreted as a wildcard, then it is proceeded by the escape character 'l'. For example, "Clems.n" is used to find a string that matches all the letters except any character can appear in the position of the wildcard. But, the pattern "al.b" means match the exact pattern "a.b" without allowing a wildcard substitution. The 'l' is considered an escape character, and is used to indicate that the next character is not a special symbol but instead is a plain character. So, "al\b" is treated as "a\b". For example, a "\." pattern is not a wildcard because of the escape character. The pattern "\\." does have a wildcard because the first ''' is an escape character but the second '\' is not. Write a program that prompts a user for an input string. Then, copy the input string to an output string called answer and remove the escape characters. Also, print the positions where the wildcards are found in the output string. Assume the input string is always less than 79 characters. For example, if the input is: Input> cl.ms .n \f. \. tbal\1 Your code must print: Wildcard in position 2 Wildcard in position 9 Final string is: cl.ms.n\f.. tball Notice the escape characters have been removed and the '.'s in positions 5 and 10 of the final string are not wildcards. int main(void) { char text [80], answer [80]; int count = 0; printf ("Input> "); fgets (text, sizeof(text), stdin)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!