Hi, It would be good if someone can help me with a regex problem am facing.
I need to compare two types of strings.
Type1 : This type of string has several substrings in it enclosed within '{$' and '$}'.
Example:
My name is {$Jill$}. I work on {$Java$} development.
Type2 : This type of string has several substrings in it enclosed within '#{' and '}'.
Example:
My name is #{Jack}. I work on #{C++} development.
When comparing string of type1 with string of type2, I want to ignore the substrings within {$...$} in type1 and those within #{...} in type2, and then compare. In the above example, ignoring the substrings within those specified characters and then comparing would yield that they are equal strings. This is the comparison that I want to do. Can you please guide hoe to do it in regex?
For type1, I tried this:
Pattern pattern = Pattern.compile("\\{.*\\}");
pattern.split(stringType1);
But this doesn't seem to work. Kindly guide.
Thanks.
I need to compare two types of strings.
Type1 : This type of string has several substrings in it enclosed within '{$' and '$}'.
Example:
My name is {$Jill$}. I work on {$Java$} development.
Type2 : This type of string has several substrings in it enclosed within '#{' and '}'.
Example:
My name is #{Jack}. I work on #{C++} development.
When comparing string of type1 with string of type2, I want to ignore the substrings within {$...$} in type1 and those within #{...} in type2, and then compare. In the above example, ignoring the substrings within those specified characters and then comparing would yield that they are equal strings. This is the comparison that I want to do. Can you please guide hoe to do it in regex?
For type1, I tried this:
Pattern pattern = Pattern.compile("\\{.*\\}");
pattern.split(stringType1);
But this doesn't seem to work. Kindly guide.
Thanks.