I just came up with a simple way to do this for rounding results in a set of Google BigQuery results -- their subset of SQL doesn't let you round to a specific decimal place a.f.a.i.k., but it does support regexes.
Since, as someone mentioned above, regexes can't add, then as long you can add a constant to each value somehow, you can still get the rest of the way there:
+ 0.5 if you're rounding up to the nearest integer
+ 0.05 if you are rounding up to the nearest 0.1
+ 0.005 if you are rounding up to the nearest 0.01 etc.
... etc. - basically add half of your smallest precision value to get the rounding effect.
And then run a regex extract on the result. The above ones will probably work done for this.
Here's the regex pattern I settled on -- which is not the most robust, but will work on a number that is already known to be in basic float format:
+ for 0.1 precision use (-?\d*\.?\d?)
+ for 0.01 precision use (-?\d*\.?\d?\d?)
+ for 0.001 precision use (-?\d*\.?\d?\d?\d?)
Then it's both rounded and truncated.