I have a table in DB. http://sqlfiddle.com/#!15/48214/1 I need to split dump column into 2 - user ID and campaign number. I have been done this using follow code:
select
substring (dump, ((position('u' in dump))+1),(length(dump)-14)) as user_id,
substring (dump, ((position('p' in dump))+3),1)) as campaign_n from "User_source";
But I need to do it using regex method in one code-row. Already studied this page http://www.postgresql.org/docs/9.1/static/functions-matching.html#FUNCTIONS-POSIX-REGEXP, but I'm a little bit confused with how to use correctly all this atoms and quantifiers for this particular task. Will be grateful for any kind of help and explanation.