Since you're using perl regexp operators, why not just use perl?
perl -pe 's/\bclass\s+\K\S+/RequiredContent/g' < your-file
\bis a word boundary operator, it will match as long as there's no word character beforeclass.\smatches any whitespace character (limited to ASCII ones as we did not tellperlto decode the input in the user's locale or UTF-8¹, so the input is interpreted as if encoded in ISO8859-1 (thankfully the 0xa0 byte, ISO8859-1's non-breaking space encoding not being considered whitespace as long as you don't add theuflag to thatsubstitution).\Kresets the start of the matched string, so only what's matched after that will be replaced, so you don't need to capture what's before to add it back in the replacement.\Sis any non-whitespace. In perl, that's equivalent to[^\s]while insed,[^\s]would match any character other than\ands.
¹ assuming the PERL_UNICODE environment variable is not set