I need get part of a string in MySQL, to put it inside a trigger where this part of a string is a key for another table and will be use as foreign key
The string looks like: P####PR#### where # is a number, after 'PR' the numbers are an ID for another table where a I need save, but... the size of the number parts is variable like
P1PR20
P20PR321
P4321PR54321
P1PR1
I need remove all characters of this string before do last numeric part
P1PR20 -> 20
P20PR321 -> 321
P4321PR54321 -> 54321
P1PR1 -> 1
please, any suggestion?