Skip to main content

Regex in handlebar to get everything after the first whitespace doesn't work during flow execution



  • Katie Conway Community moderator Principal Technical Writer
    Celigo University Level 3: Master

    Hi Ugene Jude -

    I created a Support ticket for this issue. You should receive an email with the information.



  • Ugene Jude Channel Partner
    Celigo University Level 4: Legendary

    Thank you Kate

  • Merik Ducker
    Awesome Follow-up
    Celigo University Level 4: Legendary

    Hi Ugene -

    I hope you're doing well.

    Did you happen to come across a solution to this one?

    - Merik

  • Merik Ducker
    Awesome Follow-up
    Celigo University Level 4: Legendary

    Here's where I landed:

    {{#compare (regexSearch VendorName " ") ">" -1}}{{trim (substring VendorName (regexSearch VendorName " "))}}{{else}}.{{/compare}}


    (regexSearch VendorName " ")
    • returns zero-indexed position of first space
    • returns -1 when string does not contain space
    (substring VendorName (regexSearch VendorName " "))
    • returns substring starting with (inclusive) first space
    • it should be noted that I've already trimmed my VendorName on earlier export
    • there would be issues if VendorName had leading spaces
    • namely, this output intended to be Last Name would be equivalent to First Name
    {{trim (substring VendorName (regexSearch VendorName " "))}}
    • removes whitespace present at start or end of substring 
    •  returns period in scenario where string does not contain a space
  • Jake Naydock
    Great Answer

    Merik Ducker Thank you for this workaround and explanation!! I ran into the same issue, and was able to get around it with your method. You just saved me a ton of time.

    For anyone else wondering, the reason that this error occurs is because Javascript does not support lookahead / lookbehind, and "?" is involved in the process. You will need to find a different way to structure your formula that avoids lookaheads/lookbehinds.


Please sign in to leave a comment.