I want to find out if a given String 'b' matches the pattern of String 'a'. Furthermore, the String 'a' may contain placeholder/slots, while String 'b' contains the actual values, which should be extracted.
Example:
String a = "Hello my name is and I am from "
String b = "Hello my name is Ben and I am from New York"
Expected Results:
-> b matches a
-> NAME = "Ben"
-> CITY = "New York"
To determine if a and b matches, I proceed as follows:
b.matches(a.replaceAll("<.*>", ".*"))
But I currently have no clue how to implement this "slot"-extraction in a generic and robust way.
I would be grateful for any recommendations/hins.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)