@Tom may have a better idea, but this seems to work for both cases: Link:\h*(\S+)\s+Password:\h*(\S+)
For those interested in learning RegEx, here is my change:
CHG \h+Password TO \s+Password
the \s includes all whitespace, including new line characters, so it will match the case when the password is on the next line.
Getting Started with Regular Expressions
Regular expressions (RegEx or RegExp) are extremely powerful, but have an initial steep learning curve that is often intimidating. But once you get over that initial hump, and you continue to write new RegExp, it will become much easier.
I do all of my RegEx development at this free website:
In this case it is trivial, but it already makes a difference as you have seen. In other cases the correct RegEx may be completely different if you don’t give all the information.
Also try to format the sample text as code block, as shown above.