I need to get values from [] and () within string. I have below string and need to use Regex to extract username and Display Name from it.
let string = "this is string from @[username](Display Name). Thank you!"
string.match(/WAHT_REGEX??/g) to get username and Display Name
How do I write Regex to get username and Display Name from the string?
>Solution :
Try this one: '@\[([^\]]+)\]\(([^\)]+)\)'
Example on the Python language
import re
text = "this is string from @[username](Display Name). Thank you!"
re.findall('@\[([^\]]+)\]\(([^\)]+)\)', text) #[('username', 'Display Name')]