I have done my due diligence and am still stuck. I have a situation where I need to locate where the last existing same character is in a search string, then check to see what follows that character. I think I need to use RLIKE to do this but maybe there is another way. Example table.column content string:
MSH|Stuff|morestuf|||
PID|stuff|morestuff|morestuffofanotherlength||wejustfollowedablank|morestuff2||^1^|||..|||||..|.||.
I what to count 19 pipes | after the keyword PID, then see if the very next character is NOT a | (there may be more than 19 pipes, or there may be less and I dont want to blow up if there are not 19 to look for)
I know I can use the LOCATE function to find my starting position after PID, not sure how to pass that position into an expression to begin counting 19 occurrences of | beyond the start position.
A partial regexp in i.e. pspad would look something like '\(.+\)PID[|]{19}'
I cant get this to not err in mysql so either the syntax is different or I am completely on the wrong track.
Any suggestions?