How to process field input so b52 goes into database as B-52 Situation: D7 Text field on a content type.

User enters something like: b52

I want it stored in the database as: B-52

I have a function that does the regex. I just don't know where to process the input before it goes in the database.

Don't want to install Field Validation or do any validation forcing a User to "correctly" format their own data. I just want to catch their input, modify it, and save it in the database as so.

What hook do I use and can it be done in the theme?
OK figured it out.

hook_node_presave() is what I want and it can only be called from a module I think.

Found the answer here: node_presave doesn&#39;t work

function nodepresave_node_presave($node){
  drupal_set_message('nodepresave DEBUG: PRESAVE Called');
  if ($node-&gt;type === 'vehicle') {
    drupal_set_message('nodepresave DEBUG: node-&gt;type === vehicle');
    drupal_set_message($node-&gt;field_id_number['und'][0]['value']);
  }}