<@U04S8PLJWMT> how can i add regex validation to u...
# ask-ai
o
@kapa.ai how can i add regex validation to user input with yaml connector builder in the ui
k
To add regex validation to a user input when building a connector with the YAML Connector Builder in the Airbyte UI, you should use the json-schema pattern property for the input field. This enforces that the value entered matches the specified regex pattern. Additionally, you can use the pattern_descriptor property to provide a human-readable format for the UI, making error messages more user-friendly. Here’s an example of how you would define this in your YAML (or JSON) spec:
Copy code
yaml start_date:   type: string   title: Start date   pattern: "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"   pattern_descriptor: "YYYY-MM-DD"
- The pattern enforces the input format (in this case, a date in YYYY-MM-DD format). - The pattern_descriptor provides a clear description to the user and is shown in error messages instead of the raw regex. When using the Connector Builder UI, you can set these properties for your user input fields to ensure proper validation and a better user experience. This approach is documented in the Airbyte connector specification reference [Pattern descriptors](https://docs.airbyte.com/platform/next/connector-development/connector-specification-reference#pattern-descriptors). For more on best practices for user input configuration and validation, see the [UX Handbook](https://docs.airbyte.com/platform/next/connector-development/ux-handbook#input-configuration).
o
@kapa.ai how can i check if the input value ending with a character and if not i want to add it to the value
k
A message from kapa.ai
I'm sorry, but the knowledge sources do not contain information about automatically checking if a user input value ends with a specific character and programmatically adding it if missing within the YAML Connector Builder UI. The available documentation covers input validation using regex (pattern) to enforce formats, but not dynamic modification of user input values based on such checks. If you need to enforce that a value ends with a specific character, you can use a regex pattern to validate the input and prompt the user to correct it, but auto-correcting the value is not described in the provided documentation. For more advanced transformations, you might need to implement a custom config transformation class, but the documentation only describes how to reference such a class, not how to use it for this specific use case [CustomConfigTransformation](https://docs.airbyte.com/platform/next/connector-development/config-based/understanding-the-yaml-file/reference#/definitions/CustomConfigTransformation). If you need further assistance, please provide more details or consult the latest Airbyte documentation.