xTuple.com xTupleU Blog & News Customer Support

Trim whitespace

Hi All

Does anyone know the correct Regex for trimming any or all white space from a string in QT Script

I have been trying

replace("[\s]+$","") to no avail

Thank you


Solved it , so for the record

var re = /[\s]+$/;


Qt Script is just a variant of javascript. Have you tried the trim() function?

var str = "  this is a string ";
var trimmed = str.trim();