A way to eliminate certain characters from user's input

I would like to alter user’s input within the Q&A.

For example, I would like user’s input that happens to be entered with the quotation marks (e.g. “some input”) to be returned (inserted into the document) without the quotation marks.

Is there a simple custom code I could use within the Q&A question?

If not, maybe this could be addressed through a special function which would automatically remove predefined characters from the input of the datafield, e.g. @remove(#data-field, character).

You can currently resolve this in three different ways:

  • Either by adding a “regular expressions” based validation that would simply refuse quotation marks (see https://help.clausebase.com/kb/question-options, the subsection on validation).
  • If the validation is too blunt towards the end-user in your situation, then you can use the @regex-replace special function on the datafield (see https://help.clausebase.com/kb/special-functions/#regex-replace). In your situation, this would be @regex-replace(#concept^field, '"', "") — this may be difficult to read with all the quoting, but this essentially says "search for quote symbols anywhere in the text, and replace them by empty text (i.e., remove them)
  • You can also write a custom (Clojure) function that performs even more advanced stuff when some answer is entered. See https://help.clausebase.com/kb/custom-functions/

Apologies, the @regex-replace was exactly what I was looking for. Cannot understand how I missed all the regex thing in the special functions part of the documentation.

However, it is good to know all the different ways this can be done. This will serve well for future reference. Thank you!