sabrogden / Ditto

Ditto is an extension to the Windows Clipboard. You copy something to the Clipboard and Ditto takes what you copied and stores it in a database to retrieve at a later time.
https://ditto-cp.sourceforge.io/
3.93k stars 208 forks source link

ChaiScript SetAsciiString not setting clip #716

Open imthenachoman opened 2 months ago

imthenachoman commented 2 months ago

I have input like last, first m and I want to convert it to first m last. So I am trying to use regex to extract the various parts and put it together but it's not returning the output I would expect.

var original = clip.GetAsciiString();

clip.AsciiTextReplaceRegex(",.*$", "");
var lastPart = clip.GetAsciiString();
clip.SetAsciiString(original);

clip.AsciiTextReplaceRegex("^.*?,", "");
var firstPart = clip.GetAsciiString();

var together = firstPart + " " + lastPart;

clip.SetAsciiString(together);

return false
  1. get the clip
  2. replace the first comma and everything after it
  3. save this string
  4. set clip back to original string
  5. replace everything up to the first comma
  6. save this string
  7. put the two strings together
  8. set the clip to the new string

But in my sample input test, it does not output anything.

image