Sorry for late reply... But my requirement is to find out all attributes in input xml which has attribute value in a pattern like ${VariableName}. Then i will get the corresponding value for this VariableName from a collection and substitute this as the value for the attribute. Its like i make an api call, get output, i have to use some values in this output and prepare the input dynalically to the next api call. I thought rather than using DOM to traverse through xml and check for each attribute in each element for value in format ${VariableName}, it will be better performance wise to use Pattern matching, to get the attributes for which values needs to be populated dynamically.
I agree that writing correct regex pattern for this task is a bit error prone.