When I use the following snippet, I always have a person's first and last name in the clipboard, ready to paste into the "{formtext: name=fullname; trim=yes}" area but it would save me a step if that info just populated automatically. My only issue is that I use "name=fullname" and I don't see where I can assign that to the clipboard info when I looked in the documentation. Trying not to have to rewrite the snippet but I guess I may have to.
{note: preview=yes}{formtext: name=fullname; trim=yes}{endnote}
{username=extractregex(fullname, "(.+?)")&extractregex(fullname, ".+? (.+)"); trim=yes}
{=lower(username); trim=yes}
{key: tab}
{first=extractregex(fullname, "(.+?) ")}{=proper(first); trim=yes}
{key: tab}
{last=extractregex(fullname, ".+? (.+)")}{=proper(last); trim=yes}
Hi Morgan,
will this work?
{note: preview=yes}{fullname={clipboard}}{endnote}
{username=extractregex(fullname, "(.+?)")&extractregex(fullname, ".+? (.+)"); trim=yes}
{=lower(username); trim=yes}
{key: tab}
{first=extractregex(fullname, "(.+?) ")}{=proper(first); trim=yes}
{key: tab}
{last=extractregex(fullname, ".+? (.+)")}{=proper(last); trim=yes}
That worked great. Not sure why my brain had a hard time with that. Thanks!
1 Like
@David_Morgan - don't be too hard on yourself. Text Blaze is like a muscle. The basics are super easy to get into, but it takes time to develop a feel for some of the more advanced stuff.
We're here to help, regardless of how basic or advanced the question is
@David_Morgan - Dan's solution works.
Alternatively you can also use the split() function.
{note: preview=yes}{formtext: name=fullname; trim=yes; default=Dorian Gray}{endnote}
{username=extractregex(fullname, "(.+?)")&extractregex(fullname, ".+? (.+)"); trim=yes}
{=lower(username); trim=yes}
{key: tab}
{=proper(split(fullname, " ")[1]); trim=yes}
{key: tab}
{=proper(split(fullname, " ")[2]); trim=yes}
In cases where the full name is more than two words:
{note: preview=yes}{formtext: name=fullname; trim=yes; default=Dorian Kelso Gray}{endnote}
{username=replace(extractregex(fullname, "(.+?)")&extractregex(fullname, ".+? (.+)"), " ", ""); trim=yes}
{=lower(username); trim=yes}
{key: tab}
{=proper(split(fullname, " ")[1]); trim=yes}
{key: tab}
{=proper(split(fullname, " ")[count(split(fullname, " "))]); trim=yes}