Q:

extract number from string in kdb

I am quite new to kdb+q. I've come across this problem of extracting a number out of string. 
Any suggestions?
Example:
"AZXER_1234_MARKET" should output 1234 //Assume that there is only one number in the 

string

A:

Extract the numbers then cast to required type.
q){"I"$x inter .Q.n} "AZXER_1234_MARKET"
1234i

q){"I"$x inter .Q.n} "AZXER_123411_MARKET"
123411i
q){"I"$x inter .Q.n} "AZXER_1234_56_MARKET"
123456i
q){"I"$x inter .Q.n} "AR_34_56_MAT"
3456i

