dimanche 28 juin 2015

Trouble Understanding Regular Expression [duplicate]

This question already has an answer here:

I am trying to learn the regular expression and I have learnt some easier notations but unable to understand what does the below expression means. Please shed some light on it.

Sample Data :

create table targets ( target varchar2(15) );

REM INSERTING into TARGETS
SET DEFINE OFF;
Insert into TARGETS (TARGET) values ('aaa');
Insert into TARGETS (TARGET) values ('a b c');
Insert into TARGETS (TARGET) values ('b  b  b  b');
Insert into TARGETS (TARGET) values ('  bbb xx  ');
Insert into TARGETS (TARGET) values ('wdef def w');
Insert into TARGETS (TARGET) values ('defxdefdef');
Insert into TARGETS (TARGET) values (null);


select target,
       regexp_replace(target,'(d)ef|.','\1') intermediate_string

from targets;

If possible please direct me to some good site for learning Regular expressions. Thanks!

Aucun commentaire:

Enregistrer un commentaire