the Textfile Content in the end should be like this:
A1234567890
B123456789012
the clipboard Content could be something like this:
bla bla text A 123 123 123 11 11 bla bla return, line feed
more text B 123 456768 9012 bla bla and so on
so the pattern I'm looking for is starting with a A followed by 10 Digits e.g. A1234567890 or coould start with B followed by 12 Digits eg. B123456789012
the problem are the space character and maybe return and line feed
in my approach I first use this code to get rid of all space characters, this seems to work well:
Code: Select all
Clipboard := RegExReplace(Clipboard, "[\s+]")
Code: Select all
((a|A)\d{10})|((b|B)\d{12})
Code: Select all
FileAppend, %clipboard%, test.txt
thanks 4 your help
Code: Select all
#x:: ;[Win]+[X]
;Empty the Clipboard.
Clipboard =
;Copy the select text to the Clipboard.
SendInput, ^c
;Wait for the Clipboard to fill.
ClipWait
;Perform the RegEx find and replace operation,
;where "ABC" is the whole-word we want to replace.
haystack := Clipboard
needle := "\b" . "ABC" . "\b"
replacement := "XYZ"
result := RegExReplace(haystack, needle, replacement)
;Empty the Clipboard
Clipboard =
;Copy the result to the Clipboard.
Clipboard := result
;Wait for the Clipboard to fill.
ClipWait
;-- Optional: --
;Send (paste) the contents of the new Clipboard.
SendInput, %Clipboard%
;Done!
return