Returning selected text from field using calculation
I am having a bad day and just can't get my head around what is a simple calculation - I am sure of that but have gone blank. Any help massively appreciated.
I have a text field that references the name of an image file and these images relate to hotels. In most instances, this file name consists of an Internal Code followed by an underscore, two digits and the .jpg file suffix. For example, 0088998899_01.jpg. In some instances the file name is used instead of a code as a record for that hotel might not exist in our database. For example, the Soho hotel_01.jpg.
Whilst the character count before the _XX.jpg isn't consistent, reading from the right the XX_.jpg is.
What I am trying to achieve is a calculation field that simply returns a text result that is the image file name excluding the _xx.jpg. Using the above as examples I need to see 0088998899 or the soho hotel etc.
Probably easy but I have just gone blank.
Thanks and best wishes