It doesn’t matter: non-persistent or persistent. You can use the function isMatch() with the value and the regex. Read more here: https://docs.mendix.com/refguide/string-function-calls
Something like this:
isMatch($R/YourStringAttribute, '^[0-9]+(\.[0-9]{1,2})?$')
// returns true (if match) or false (if no match)