Is there a way to access the js-standard "encodeURIComponent" function in a pipeline's Eval?

More specifically, I want to make sure the value doesn’t contain any special characters that would confuse later parsing, such as = or space.

My inclination would be to use Mask to replace anything non-alphanumeric (and dashes?) with an underscore.

[^-_a-zA-Z0-9]+     =>   '_'

Be sure to check the global flag.

EDIT: @david pointed out we also have functions for this

What you are looking for is called Cribl Expressions. Specifically, the C.Encode.uri expression:

`C.Encode.uri`
(method) `Encode.uri(val: string): string`
Returns the URI-encoded representation of the given string.
@param – `val` – value to uri encode.

Is C.Encode.uri() equivalent to JS’s encodeURI() or encodeURIComponent()?

@eugene C.Encode.uri() is a simple wrapper around encodeURIComponent()

1 UpGoat