Matching data on the clipboard with RegExMatch
Posted: 17 Apr 2024, 11:23
I'm using RegExMatch on the clipboard to assign variables to found data like so...
I'm trying to match a value only if it is provided. When the value is blank, the clipboard data returned is <d:Case_x0020__x0023_ m:null="true" />. When the value exists, the clipboard data returned is <d:Case_x0020__x0023_>123456</d:Case_x0020__x0023_>. So if it exists, I want to grab 123456 and assign it to a variable and if it does not exist, do nothing.
I know if the value always existed, I could use something like RegExMatch(A_Clipboard, 's)<d:Case_x0020__x0023_>(.*?)</d:Case_x0020__x0023_>', &CaseNum).
Any assistance is appreciated.
Code: Select all
RegExMatch(A_Clipboard, 's)<d:Last_x0020_Name.*?>(.*?)</d:Last_x0020_Name>', &LastName)
RegExMatch(A_Clipboard, 's)<d:First_x0020_Name.*?>(.*?)</d:First_x0020_Name>', &FirstName)
I know if the value always existed, I could use something like RegExMatch(A_Clipboard, 's)<d:Case_x0020__x0023_>(.*?)</d:Case_x0020__x0023_>', &CaseNum).
Any assistance is appreciated.