regex - ORACLE REGEXP_SUBSTR that match digits between square brackets -
i have varchar column no have specific format.
these examples:
afdsbfgf, jbhttp://www.iabvdfbdos.com/view.php?p_id=170405, arcm, cocm, fbus, bv[123545]
i need match substring between brackets when string 'bv[123545]'. substring numeric.
i tried that:
regexp_substr (my_column, '[^bv\[]+[[:digit:]]+')
but matches
'jbhttp://www.iabvdfbdos.com/view.php?p_id=170405' , returns "_id=170405"
thanks in advance
assumes brackets appear once in line. grabs first sub-group (the part in parens) of first occurrence of 'bv' followed left square bracket, followed 1 or more digits, followed right square bracket. square brackets escaped define character class in regex engine otherwise.
sql> select regexp_substr('afdsbfgf, jbhttp://www.iabvdfbdos.com/view.php?p_id=170405, arcm, cocm, fbus, bv[123545]', 'bv\[(\d+)\]', 1, 1, null, 1 ) dual; regexp ------ 123545 sql>
Comments
Post a Comment