Oracle regular expression help

I have worked with regular expressions a little bit in unix scripting.
I need to diff two schemas to look for missing objects.
Problem: I changed the naming conventions.
My objects used to end with '_T' and now end with '_MV'
I cant use regular instr because I can have
HELLO_TYPES_T or I could have HELLO_T
I want to trim off the last T and MV and then do a minus to see if I am missing objects.
I I think I need to use regexp_instr with an end of line regular expression, but I can't get the syntax correct. Can someone give me a hand?

Well, how about this:
SQL> with schema1
  2   as ( select  'HELLO_TYPES_T' obj from dual union all
  3        select  'HELLO_T' from dual union all
  4        select  'TYPES_T' obj from dual union all
  5        select  'HELLO_TYPES_MV' obj from dual union all
  6        select  'HELLO_MV' from dual union all
  7        select  'TYPES_MV' obj from dual union all    
  8        select  'OBJECTS_T' obj from dual )
  9  ,    schema2
10   as ( select  'HELLO_TYPES_T' obj from dual union all
11        select  'HELLO_T' from dual union all
12        select  'TYPES_T' obj from dual union all
13        select  'HELLO_TYPES_MV' obj from dual union all
14        select  'HELLO_MV' from dual union all
15        select  'TYPES_MV' obj from dual)
         ---actual query
16    select regexp_replace(obj, '^*(_T|_MV)$', '') regexp
17    from   schema1
18    minus
19    select regexp_replace(obj, '^*(_T|_MV)$', '') regexp
20    from   schema2;
REGEXP
OBJECTS
1 row selected.And vice versa (schema2 minus schema1)

Similar Messages

  • Need PL/SQL - Oracle Regular Expressions help

    Hi all,
    I have to create script some schema in oracle database to update our SVN. And after create DDL scrip need to do some modification (Ex: add columns). Example as follows,
    After create table DDL original scripts as follows,
    --table format 1
    CREATE TABLE "USER"."TABLE1"
            "COLUMN1"   NUMBER,
            "COLUMN2"   NUMBER,
            "COLUMN3"   NUMBER,
            "COLUMN4"   VARCHAR2(20 BYTE),
            PRIMARY KEY ("COLUMN1") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "T1" ENABLE
        PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
            INITIAL 35651584 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
        TABLESPACE "T1" ;
    CREATE INDEX "USER"."TABLE1_COLUMN2" ON "USER"."TABLE1"
            "COLUMN2"
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
            INITIAL 196608 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
        TABLESPACE "T1" ;
    CREATE INDEX "USER"."TABLE1_COLUMN3" ON "SPIDERP4"."TABLE1"
            "COLUMN3"
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
            INITIAL 458752 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
        TABLESPACE "T1" ;
    --table format 2
    CREATE TABLE "USER"."TABLE2"
            "COLUMN1"  NUMBER,
            "COLUMN2"  NUMBER,
            "COLUMN3"  NUMBER,
            "COLUMN4"  VARCHAR2(20 BYTE)
        PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
            INITIAL 35651584 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
        TABLESPACE "T1" ;
    CREATE INDEX "USER"."TABLE2_COLUMN1" ON "USER"."TABLE2"
            "COLUMN1"
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
            INITIAL 196608 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
        TABLESPACE "T1" ;
    CREATE INDEX "USER"."TABLE2_COLUMN2" ON "SPIDERP4"."TABLE2"
            "COLUMN2"
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
            INITIAL 458752 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
        TABLESPACE "T1" ;
    I need to include following amendment to above table scripts (expecting results),
    --1
    CREATE TABLE "USER"."TABLE1"
            "COLUMN1"   NUMBER,
            "COLUMN2"   NUMBER,
            "COLUMN3"   NUMBER,
            "COLUMN4"   VARCHAR2(20 BYTE),
            _*"COLUMN5"   NUMBER(3,0) DEFAULT 0,*_
            PRIMARY KEY ("COLUMN1") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "T1" ENABLE
        PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
            INITIAL 35651584 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
        TABLESPACE "T1" ;
    CREATE INDEX "USER"."TABLE1_COLUMN2" ON "USER"."TABLE1"
            "COLUMN2"
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
            INITIAL 196608 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
        TABLESPACE "T1" ;
    CREATE INDEX "USER"."TABLE1_COLUMN3" ON "SPIDERP4"."TABLE1"
            "COLUMN3"
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
            INITIAL 458752 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
        TABLESPACE "T1" ;
    --2
    CREATE TABLE "USER"."TABLE2"
            "COLUMN1"  NUMBER,
            "COLUMN2"  NUMBER,
            "COLUMN3"  NUMBER,
            "COLUMN4"  VARCHAR2(20 BYTE),
            _*"COLUMN5"  NUMBER(3,0) DEFAULT 0*_
        PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE
            INITIAL 35651584 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
        TABLESPACE "T1" ;
    CREATE INDEX "USER"."TABLE2_COLUMN1" ON "USER"."TABLE2"
            "COLUMN1"
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
            INITIAL 196608 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
        TABLESPACE "T1" ;
    CREATE INDEX "USER"."TABLE2_COLUMN2" ON "SPIDERP4"."TABLE2"
            "COLUMN2"
        PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS STORAGE
            INITIAL 458752 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
        TABLESPACE "T1" ;
    /Note:
    I need solution apart from these conditions,
    1)Table cannot be modify before create DDL (DDL creating using this method “dbms_metadata.get_ddl” ).
    2)This is automated processes manual modification cannot be allow.
    3)We cannot hard-coded any Dynamic Values because above create DDL table just for explain my question.(**note : “PCTFREE” ,” PRIMARY KEY”, “),”.... above values can be hard-coded**)
    Thanks
    Tharindu Dhaneenja
    Edited by: Dhaneenja on Mar 14, 2011 11:16 PM
    Edited by: Dhaneenja on Mar 14, 2011 11:17 PM
    Edited by: BluShadow on 15-Mar-2011 09:08
    Added {noformat}{noformat} tags                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    not very safe code to do what you are looking for...
    =================test data========================
    SET ECHO ON FEED OFF LIN 2000 PAGES 9999  LONG 1000000 LONGC 1000 TRIMS ON;
    EXEC DBMS_METADATA.SET_TRANSFORM_PARAM( DBMS_METADATA.SESSION_TRANSFORM,'SQLTERMINATOR',TRUE);
    DROP USER u CASCADE;
    GRANT DBA TO u IDENTIFIED BY u;
    CREATE TABLE u.t1
       c1   NUMBER,
       c2   NUMBER,
       c3   NUMBER,
       c4   NUMBER,
       PRIMARY KEY (c1)
    CREATE TABLE u.t2
       c1   NUMBER,
       c2   NUMBER,
       c3   NUMBER,
       c4   NUMBER
    CREATE TABLE u.t3
       c1   NUMBER NOT NULL,
       c2   NUMBER,
       c3   NUMBER
    CREATE TABLE u.t4 (c1 NUMBER    REFERENCES u.t1);
    CREATE TABLE u.t5 (c1 NUMBER UNIQUE);
    CREATE TABLE u.t6 (c1 NUMBER CHECK (c1 > 0));
    CREATE TABLE u.t7 (c1 NUMBER NOT NULL);=================query========================
    SELECT CASE
              WHEN (SELECT COUNT (*)
                      FROM dba_tab_columns tc
                     WHERE tc.owner = o.owner AND tc.table_name = o.object_name) >
                      0
              THEN
                 SUBSTR (
                    DBMS_METADATA.get_ddl (object_type, object_name, owner),
                    1,
                    INSTR (
                       DBMS_METADATA.get_ddl (object_type, object_name, owner),
                       CHR (10),
                       1,
                       2
                       + (SELECT COUNT (*)
                            FROM dba_tab_columns tc
                           WHERE tc.owner = o.owner
                                 AND tc.table_name = o.object_name)))
                 || CASE
                       WHEN (SELECT COUNT (*)
                               FROM sys.obj$ so,
                                    sys.cdef$ scd,
                                    sys.con$ sc,
                                    sys.user$ su
                              WHERE     su.user# = so.owner#
                                    AND so.obj# = scd.obj#
                                    AND scd.con# = sc.con#
                                    AND so.obj# = scd.obj#
                                    AND scd.type# != 7
                                    AND so.name = o.object_name
                                    AND su.name = o.owner) = 0
                       THEN
                          ',column5 number(3,0) default 0'
                       ELSE
                          'column5 number(3,0) default 0,'
                    END
                 || SUBSTR (
                       DBMS_METADATA.get_ddl (object_type, object_name, owner),
                       INSTR (
                          DBMS_METADATA.get_ddl (object_type, object_name, owner),
                          CHR (10),
                          1,
                          2
                          + (SELECT COUNT (*)
                               FROM dba_tab_columns tc
                              WHERE tc.owner = o.owner
                                    AND tc.table_name = o.object_name)))
              ELSE
                 DBMS_METADATA.get_ddl (object_type, object_name, owner)
           END
              t
      FROM dba_objects o
    WHERE owner = 'U';=================output========================
      CREATE TABLE "U"."T1"
       (    "C1" NUMBER,
            "C2" NUMBER,
            "C3" NUMBER,
            "C4" NUMBER,
    column5 number(3,0) default 0,
             PRIMARY KEY ("C1")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
      TABLESPACE "USERS"  ENABLE
       ) SEGMENT CREATION DEFERRED
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      TABLESPACE "USERS" ;
      CREATE UNIQUE INDEX "U"."SYS_C0025504" ON "U"."T1" ("C1")
      PCTFREE 10 INITRANS 2 MAXTRANS 255
      TABLESPACE "USERS" ;
      CREATE TABLE "U"."T3"
       (    "C1" NUMBER NOT NULL ENABLE,
            "C2" NUMBER,
            "C3" NUMBER
    ,column5 number(3,0) default 0
       ) SEGMENT CREATION DEFERRED
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      TABLESPACE "USERS" ;
      CREATE TABLE "U"."T4"
       (    "C1" NUMBER,
    column5 number(3,0) default 0,
             FOREIGN KEY ("C1")
              REFERENCES "U"."T1" ("C1") ENABLE
       ) SEGMENT CREATION DEFERRED
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      TABLESPACE "USERS" ;
      CREATE TABLE "U"."T2"
       (    "C1" NUMBER,
            "C2" NUMBER,
            "C3" NUMBER,
            "C4" NUMBER
    ,column5 number(3,0) default 0
       ) SEGMENT CREATION DEFERRED
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      TABLESPACE "USERS" ;
      CREATE TABLE "U"."T5"
       (    "C1" NUMBER,
    column5 number(3,0) default 0,
             UNIQUE ("C1")
      USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
      TABLESPACE "USERS"  ENABLE
       ) SEGMENT CREATION DEFERRED
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      TABLESPACE "USERS" ;
      CREATE UNIQUE INDEX "U"."SYS_C0025507" ON "U"."T5" ("C1")
      PCTFREE 10 INITRANS 2 MAXTRANS 255
      TABLESPACE "USERS" ;
      CREATE TABLE "U"."T6"
       (    "C1" NUMBER,
    column5 number(3,0) default 0,
             CHECK (c1 > 0) ENABLE
       ) SEGMENT CREATION DEFERRED
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      TABLESPACE "USERS" ;
      CREATE TABLE "U"."T7"
       (    "C1" NUMBER NOT NULL ENABLE
    ,column5 number(3,0) default 0
       ) SEGMENT CREATION DEFERRED
      PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
      TABLESPACE "USERS" ;

  • Oracle Regular Expressions in Java?

    JDEV 10.1.3
    ADF BC
    ADF Faces
    Is there a Java library for dealing with Oracle regular expressions? I would like to be able to test a String against an Oracle regular expression for pattern match.
    Thank you,

    Hi,
    Java supports RegularEpressions: http://www.exampledepot.com/egs/java.util.regex/pkg.html
    Frank

  • Regular Expression help required

    {color:#000000}Hi....
    I am having a product table in oracle with products like CZS20T and CZSS30T and so on....
    But for printing on the invoice we need only the product name without the micron thickness like CZS and CZSS{color}{color:#000000}
    I tried regular expression with....."select regexp_substr('CZSS20T','([[:digit:]]{2})') from dual"
    {color}
    and the result was "20"*...*
    But I cant figure out how to use regular expression to get only the product name.
    Maybe there is another way without using Regular exp...
    Please help....

    regexp_substr (prod, '[[:alpha:]]*')and an example:
    SQL> with x as
      2  ( select 'CZS20T' prod from dual union all
      3    select 'CZSS30T' from dual union all
      4    select 'A10CSD' from dual
      5  )
      6  select prod
      7       , regexp_substr (prod, '[[:alpha:]]*')
      8    from x
      9  ; 
    PROD    REGEXP_SUBSTR(PROD,'[[:ALPHA
    CZS20T  CZS
    CZSS30T CZSS
    A10CSD  A
    SQL> Edited by: Alex Nuijten on Jan 27, 2009 8:52 AM

  • Regular Expression Help

    I need help writting a regular expression that will match the following strings:
    1+1,1+(1+1),((1+1)+(1+1)),1+(1+(1+1)). Basically one that will match an arithmetic expression (operands limited to 1's and operators to '+' sign) with or without correctly matched parentheses. Have'nt had much luck so far. Any input will help. thanks

    okay, you asked for it:
    [1+()]+
    it will only match those string but it will tell you nothing about syntactically correct expressions. This is because these types of expression are not "regular" and cannot be properly parsed using regular expressions.

  • Regular expressions help

    I'm using a RegExp class (http://www.jurjans.lv/flash/RegExp.html) to do some regular expression in AS2. But I'm not very good at it.
    var str:String="What if there are other variables, such as possible <a class='gloss' href='asfunction:_root.handle, confounding variables'><b>confounding variables</b></a> which could explain at least some of the relationship between the two variables? Here <a href='' target='_blank'>is another link</a>.\n<a class='gloss' href='asfunction:_root.handle, confounding variables'>confounded variables</a>"
    var reg1:RegExp = new RegExp("<a.*gloss.*href=[\'\"]?([^\\\'\">]+)>+(.*</a>)", "ig");
    var obj:Object = reg1.exec(str);
    while (obj != null) {
              for(var a in obj){
                        if(!isNaN(a)){
                        trace(a+": "+obj[a]);
              trace(newline);
              obj = reg1.exec(str);
    And this traces:
    2: <b>confounding variables</b></a>
    1: asfunction:_root.handle, confounding variables'
    0: <a class='gloss' href='asfunction:_root.handle, confounding variables'><b>confounding variables</b></a>
    2: confounded variables</a>
    1: asfunction:_root.handle, confounding variables'
    0: <a class='gloss' href='asfunction:_root.handle, confounding variables'>confounded variables</a>
    I'm trying to get the href and the "friendly link" part of the anchor tag (but only for anchors that have a class of gloss).
    As you can see I'm almost there, but I'm getting the extra </a> and the extra ' on the two examples. I tried putting the ) before the </a> but that just broke it. (Of course that could be because this class doesn't work properly, but I'm guessing that isn't the case.)
    Anybody really good with regular expressions who can help me out?

    Looks like there is a "greedy" bug with the () in that AS2 implementation.
    I also have a problem the expression matching not the next occurance of the closing </a> but the final one.
    Anybody have any ideas of other ways to do this?

  • Oracle regular expressions REGEXP_SUBSTR

    Hi,
    I'm relatively new here and this is might be a kind of silly.
    Start using reg expressiona and do not know how to get the second pattern from the end (7 in this case)?
    select REGEXP_SUBSTR('1/2/3/4/5/6/7/8' ,'[^/]+$',1, 1),
    REGEXP_SUBSTR('1/2/3/4/5/6/7/8' ,'[^/]+$',1, 2),
    REGEXP_SUBSTR('1/2/3/4/5/6/7/8' ,'[^/]+$')
    from dual;
    Please help.
    Edited by: lsy_nn on Jul 21, 2010 1:51 PM

    RegExp_Replace is useful ;-)
    Let us read these threads.
    I have created part4 :8}
    Introduction to regular expressions part1 to part4
    Introduction to regular expressions ...
    Introduction to regular expressions ... continued.
    Introduction to regular expressions ... last part.
    Introduction to regular expressions part4
    col extStr for a10
    select
    RegExp_Replace('1/2/3/4/5/6/7/8',
                   '^.*([^/]+)/.*$',
                   '\1') as extStr
    from dual;
    EXTSTR
    7

  • Phone number Regular expression Help

    Hi,
    I am trying to validate phone number using regular expression.
    The format shoud be either of the two given below. It should not
    accept phone number of any other format other than the once given below.
    I tried out the following regular expression
    pn.matches("[\p{+}][0-9]+ ")
    but it accepts alphabets too(which is wrong).
    How do i check if the phone number is of the following format(OR condition).
    0401234567
    +358501234567
    Any help would be kindly appriciated.
    Thanks
    Sanam

    There will probably be much more constraints on you phone numbers, but here's a start:String[] numbers = {"0401234567",      // should be ok
                        "040123456",       // wrong, one number too little
                        "+358501234567",   // should be ok
                        "+3585012345670",  // wrong, one number too much
                        "+35850123456"};   // wrong, one number too little
    String regex = "\\+[0-9]{12}"+         // a + sign, followed by 12 numbers
                   "|"+                    // OR
                   "0[0-9]{9}";            // a zero, followed by 9 numbers
    for(String n : numbers) {
      System.out.println("Is "+n+" valid? "+n.matches(regex));
    }

  • Regular Expression Help Please?

    Hi
    I'm trying to get my head round regular expressions in find
    and replace,
    it's a slow process for me!
    I have this -
    <a
    href="
    http://www.forms.mydomainname.com/cgi-bin/urltracker/tracker.pl?site=http://www.website-ad dress.com"
    and I'm trying to change it to this -
    <a
    href="
    http://www.forms.mydomainname.com/cgi-bin/urltracker/tracker.pl?site=http://www.website-ad dress.com&email="
    I was trying first of all with a *.*, but couldn't work out
    how to tell it
    where the code ends?
    They are hundred of pages like this, all with different
    website-addresses.
    After I have changed all the pages to the new code, I then
    will need to copy
    and paste an different email address to the end of each line,
    to each page.
    Unless anyone knows a way of automating that?
    Hope someone can point me in the right direction?
    Many thanks, Craig.

    Hi David
    Many thanks for all that and the detailed descriptions.
    I will be working through it all again tomorrow, so will put
    your info to
    the test! lol
    As for partially building the email addresses, I think that
    would be too
    much,
    as the emails are all over the place, some have their own
    domain, other use
    hotmail, Yahoo etc.
    Some even have they own domain for their website and a free
    one for the
    email address.
    They are all Hotels, B&B' & Cottages etc.
    Hopefully all your hard work will help me a step closer to
    understanding it
    all.
    Many thanks again,
    Craig.
    "David Stiller" <[email protected]> wrote in
    message
    news:[email protected]...
    > Craig,
    >
    >> You do have that correct David, thanks.
    >
    > Okay.
    Regex is as much an "exact science" as it is an "art
    > form" -- which isn't to say I'm a regex artist; I just
    love the
    > technology -- but I mention this because I made the
    following assumption
    > in order to keep the pattern relatively simple: your
    href values are all
    > quoted in either single or double quotes. Such as, for
    example, the
    > following sample HTML ...
    >
    > <body>
    > <a
    > href="
    http://www.forms.mydomainname.com/cgi-bin/urltracker/tracker.pl?site=www.sample.com">asfd< /a>
    > <a
    > href='
    http://www.forms.mydomainname.com/cgi-bin/urltracker/tracker.pl?site=www.example.net'></a>
    > <a
    > href="
    http://www.forms.mydomainname.com/cgi-bin/urltracker/tracker.pl?site=www.company.com"></a>
    > </body>
    >
    > In the Find field, enter this pattern ...
    >
    > (tracker\.pl\?site=.*?)(["'])
    >
    > ... and in the Replace field, enter this pattern ...
    >
    > $1&email=ADDRESS$2
    >
    > Then carefully use your Find Next and Replace buttons to
    step through
    > your code. The above will add &email=ADDRESS to your
    HTML in all the
    > right places. I chose that because ADDRESS is easy to
    select by double
    > clicking, which should facilitate your replacing it.
    >
    >
    > Let's step through the patterns.
    >
    > (tracker\.pl\?site=[^"']*?)(["'])
    >
    > This looks for the phrase "tracker.pl?site=" (without
    quotes) followed
    > immediately by a "non-greedy" match of any character
    that isn't a single
    > or double quotation mark, followed immediately by either
    a single or
    > double quotation mark. I took , which I took to be a
    safe, short "hook"
    > into the string we need. I split this pattern into two
    sections, grouped
    > by parentheses. This allows us to refer to the first
    part of the match
    > (everything but the closing quotation mark) as group 1,
    and the second
    > part (the closing quotatin mark) as group 2. This is
    like storying values
    > with your calculator's M (memory) button.
    >
    > $1&email=ADDRESS$2
    >
    > Here, we refer to group 1 and follow it with the phrase
    > "&email=ADDRESS" (without quotes), followed again by
    group 2.
    >
    > Now, in theory, we could use the domain name of each
    unique site to at
    > least partially build the email address. That would get
    you even closer
    > to your goal. To do so, I'd need even more detail from
    you, such as the
    > kinds of domains you have (how many sub domains are
    probable, etc.).
    >
    >
    > David
    > stiller (at) quip (dot) net
    > Dev essays:
    http://www.quip.net/blog/
    > "Luck is the residue of good design."
    >

  • PL/SQL Regular Expression help.

    A'ight, I'm braindead today and cannot figure this out. I have data that can be in following formats:
    format 1: '123 (A XXX)'
    format 2: '123 (A (XXX) Z)'
    format 3: '123 (A (XXX) Z)(B (YYY) Z)'
    Looking for a regular expression that will parse data and return following:
    result 1: '(A XXX)'
    result 2: '(A (XXX) Z)'
    result 3: '(A (XXX) Z)'
    Thanks for your help.

    SQL>l
      1  with t as (
      2  select '123 (A XXX)' col from dual union all
      3  select '123 (A (XXX) Z)' from dual union all
      4  select '123 (A (XXX ) Z)' from dual union all
      5  select '123 (A (XXX) Z )' from dual union all
      6  select '123 (A (XXX) Z)(B (YYY) Z)' from dual union all
      7  select '123 (A (XXX) Z )(B (YYY) Z)' from dual union all
      8  select '123 (A (XXX) Z) (B (YYY) Z)' from dual union all
      9  select '123 (A (XXX) Z ) (B (YYY) Z)' from dual
    10  )
    11  select col, length(col), instr(col, '(') sp, instr(col, ')')-1 ep,
    12  substr( col , instr(col, '(') , instr(col, ')')-1) new_col
    13* from t
    SQL>/
    COL                               LENGTH(COL)               SP               EP NEW_COL
    ============================ ================ ================ ================ ==============================
    123 (A XXX)                                11                5               10 (A XXX)
    123 (A (XXX) Z)                            15                5               11 (A (XXX) Z)
    123 (A (XXX ) Z)                           16                5               12 (A (XXX ) Z)
    123 (A (XXX) Z )                           16                5               11 (A (XXX) Z
    123 (A (XXX) Z)(B (YYY) Z)                 26                5               11 (A (XXX) Z)
    123 (A (XXX) Z )(B (YYY) Z)                27                5               11 (A (XXX) Z
    123 (A (XXX) Z) (B (YYY) Z)                27                5               11 (A (XXX) Z)
    123 (A (XXX) Z ) (B (YYY) Z)               28                5               11 (A (XXX) Z
    8 rows selected.

  • Regular expression help to solve sys_refcursor for a record

    In reference to my thread Question on sys_refcursor with record type , I thought it can be solved differently. That is:
    I have a string like '8:1706,1194,1817~1:1217,1613,1215,1250'
    I need to do some manipulation using regular expressions and acheive some thing like
    select * from <table> where
    c1 in (8,1)
    and c2 in (1706,1194,1817,1217,1613,1215,1250);Is it possible using regular expressions in a single select statement?

    Hi,
    Clearance 6`- 8`` wrote:
    Your understanding is absolutely correct. But unfortunately it did not work Frank.
    SQL> SELECT COUNT (*)
    2    FROM (SELECT sp.*
    3            FROM spml sp, spml_assignment spag
    4           WHERE sp.spml_id = spag.spml_id
    5             AND spag.class_of_svc_id = 8
    6             AND spag.service_type_id IN (1706, 1194, 1817)
    7             AND spag.carrier_id = 4445
    8             AND NVL (spag.haulage_type_id, -1) = NVL (NULL, -1)
    9             AND spag.effdate = TO_DATE ('01/01/2000', 'mm/dd/yyyy')
    10             AND spag.unit_id = 5
    11             AND sales_org_id = 1
    12          UNION ALL
    13          SELECT sp.*
    14            FROM spml sp, spml_assignment spag
    15           WHERE sp.spml_id = spag.spml_id
    16             AND spag.class_of_svc_id = 1
    17             AND spag.service_type_id IN (1217, 1613, 1215, 1250)
    18             AND spag.carrier_id = 4445
    19             AND NVL (spag.haulage_type_id, -1) = NVL (NULL, -1)
    20             AND spag.effdate = TO_DATE ('01/01/2000', 'mm/dd/yyyy')
    21             AND spag.unit_id = 5
    22             AND sales_org_id = 1);
    COUNT(*)
    88
    SQL> SELECT COUNT (*)
    2    FROM spml sp, spml_assignment spag
    3   WHERE sp.spml_id = spag.spml_id
    4     AND spag.carrier_id = 4445
    5     AND NVL (spag.haulage_type_id, -1) = NVL (NULL, -1)
    6     AND spag.effdate = TO_DATE ('01/01/2000', 'mm/dd/yyyy')
    7     AND spag.unit_id = 5
    8     AND sales_org_id = 1
    9     AND REGEXP_LIKE ('8:1706,1194,1817~1:1217,1613,1215,1250',
    10                      '(^|~)' || spag.class_of_svc_id || ':'
    11                     )
    12     AND REGEXP_LIKE ('8:1706,1194,1817~1:1217,1613,1215,1250',
    13                      '(:|,)' || spag.service_type_id || '(,|$)'
    14                     );
    COUNT(*)
    140
    SQL> Edited by: Clearance 6`- 8`` on Aug 11, 2009 8:04 PMJust serving what you ordered!
    Originally, you said you were looking for something that produced the same result as
    where   c1 in (8, 1)
    and      c2 in (1706, 1194, 1817, 1217, 1613, 1215, 1250)that is, any of the c1s could be paired with any of the c2s.
    Now it looks like what you want is
    where     (     c1 = 8
         and     c2 IN (1706, 1194, 1817)
    or     (     c1 = 1
         and     c2 IN (1217, 1613, 1215, 1250)
         )that is, c1=8 and c2=1250 is no good; neither is c1=1 and c2=1706.
    In that case, try
    WHERE     REGEXP_LIKE ( s
                  , '(^|~)' || c1
                         || ':([0-9]+,)*'
                         || c2
                         || '(,|~|$)'
                  )

  • Regular Expressions Help in Dreamweaver

    Hi i am using Dreamweaver CS3, i am creating more than 100 HTML files every couple of days and need to use the regular Expressions Feature in the Find and Replace box but couldn't find or generate the expression i am looking For, i want to Replace every images name to be same as it's htm file name across all htm Files.
    Ex : cieg.htm
    <tr>
        <td colspan="2"><table id="Table_04" width="850" height="88" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td><img src="Viva/XXXthefilenameXXX_38.gif" width="213" height="88"></td>
              <td><img src="Viva/XXXthefilenameXXX_39.gif" width="212" height="88"></td>
              <td><img src="Viva/XXXthefilenameXXX_40.gif" width="213" height="88"></td>
              <td><img src="Viva/XXXthefilenameXXX_41.gif" width="212" height="88"></td>
            </tr>
          </table></td>
      </tr>
    and replace it to be:
    <tr>
        <td colspan="2"><table id="Table_04" width="850" height="88" border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td><img src="Viva/cieg_38.gif" width="213" height="88"></td>
              <td><img src="Viva/cieg_39.gif" width="212" height="88"></td>
              <td><img src="Viva/cieg_40.gif" width="213" height="88"></td>
              <td><img src="Viva/cieg_41.gif" width="212" height="88"></td>
            </tr>
          </table></td>
      </tr>
    and same as another htm file named zsac.htm
    Any one knows a way to do it???
    Regards

    Dreamweaver's Find and Replace can't use the filename automatically. You would need to do it separately for each page. However, the following regular expression should speed up the process on individual pages:
    Find in: Current Document
    Search: Source Code
    Find:
    (<img src="Viva/)[\w]+(\d{2}.gif")
    Replace
    $1cieg_$2
    In other words, you need to add "cieg" or the name of the file between $1 and _$2.
    [Edited by DP to correct error in first sentence. DW cannot use the filename automatically.]

  • Regular Expressions help needed.

    Hi,
    I have lines like
              <div id="contentSub">         26
              /*]]>*/</style>         27
    <ul>         30
    Dylan is gay         36
    var wgNamespaceNumber = 0;         41You see every line is contained a string plus some white spaces then plus a number.
    How to retrieve the strings?
    Such that becomes
    <div id="contentSub">
              /*]]>*/</style>
    <ul>  
    Dylan is gay   
    var wgNamespaceNumber = 0;  And also get the number by a regular expression
    26
    27
    30
    36
    41Thanks

    I believe that
    "^(.*)\\s+(\\d+)$"would do the trick. Pick the two groups out from the Matcher.

  • Regular expressions HELP :S

    Hi all,
    I am trying to use the pattern and matcher to check that someone has entered a double in the form of 0000.00 where the first part can be any amount (and can exceed four digits) but it must be followed by a decimal point and two further digits. Using focus lost I wanted to clear the input if it is incorrect and disable the ADD button which allows them to proceed.
    Below is my code, the first part for moduleCode works fine, but I can't get anything from the tuitionFee bit, and I'm guessing its my regular expressions??
         public void focusLost (FocusEvent e)
         if (e.getSource () == moduleCode)
         Pattern p = Pattern.compile("[A-Z][A-Z][A-Z][0-9][0-9][0-9]");
              Matcher m = p.matcher(moduleCode.getText ());
              if(!m.matches())
                   moduleCode.setText("");
              error.setText ("PLEASE ENTER 3 UPPERCASE LETTERS FOLLOWED BY 3 DIGITS");
              add.setEnabled (false);     
         if (e.getSource () == tuitionFee)
              Pattern q = Pattern.compile ("[0-9]+?.[0-9][0-9]");
              Matcher d = q.matcher(tuitionFee.getText ());
              if(!d.matches())
                   tuitionFeeCode.setText("");
         add.setEnabled ();     
         }

    Thanks very much for the reply
    I tried the following
         public void focusLost (FocusEvent e)
            if (e.getSource () == moduleCode)
              Pattern p = Pattern.compile("[A-Z][A-Z][A-Z][0-9][0-9][0-9]");
               Matcher m = p.matcher(moduleCode.getText ());
               if(!m.matches())
                   moduleCode.setText("");
                     error.setText ("PLEASE ENTER 3 UPPERCASE LETTERS FOLLOWED BY 3 DIGITS");
                     add.setEnabled (false);     
            else if (e.getSource () == tuitionFee)
                    Pattern q = Pattern.compile ("[0-9]+\\.[0-9][0-9]");
                    Matcher d = q.matcher(tuitionFee.getText ());
                    if(!d.matches())
                     tuitionFee.setText("");
                     error.setText ("PLEASE ENTER THE VALUE IN POUNDS FOLLOWED BY A DECIMAL, THEN THE VALUE IN PENCE");
                   add.setEnabled (false);     
         }However, it still had the same result. When I left the text field the input remained there, whereas it should have cleared if functioning properly?
    thanks

  • Oracle Regular expression issue

    Hi All,
    I have regular expression problem.
    create table url ( Url varchar2(1024));
    insert into URL values ('http://abc.jambo.com/ababs/sffef/dsf/sdfdsf/jk.htm')
    insert into URL values ('.*amazon.com.*');
    insert into URL values ('Abc.com');
    insert into URL values ('xyz.Abc.com');
    insert into URL values ('^http://bhido.jambo.com/ababs/kd.htm     ');
    commit
    SELECT url,REGEXP_SUBSTR(url,'http://([[:alnum:]]+\.?){3,4}/?') "REGEXP_SUBSTR"
    FROM url
    But it returns following result
    URL                                                                       REGEXP_SUBSTR
    http://abc.jambo.com/ababs/sffef/dsf/sdfdsf/jk.htm         http://abc.jambo.com/
    .**abc.amazon.com.**                                                 NULL
    Abc.com                                                                 NULL
    xyz.Abc.com                                                         NULL
    .**amazon.com.**                                                         NULL
    ^http://bhido.jambo.com/ababs/kd.htm                         http://bhido.jambo.com/
    *What changes would be required in RegEx to get following output*
    *URL                                                                       REGEXP_SUBSTR*
    http://abc.jambo.com/ababs/sffef/dsf/sdfdsf/jk.htm         abc.jambo.com
    .**abc.amazon.com.**                                                 abc.amazon.com
    Abc.com                                                                 Abc.com
    xyz.Abc.com                                                         xyz.Abc.com
    .**amazon.com.**                                                         amazon.com
    ^http://bhido.jambo.com/ababs/kd.htm                         bhido.jambo.comThanks in advance
    -Kuldeep
    Edited by: Kuldeep2 on Apr 28, 2009 3:56 AM
    Edited by: Kuldeep2 on Apr 29, 2009 3:28 AM

    SQL> select url, regexp_substr(url,'[[:alnum:]|\.]*com')new_url from url
      2  /
    URL                                                NEW_URL
    http://abc.jambo.com/ababs/sffef/dsf/sdfdsf/jk.htm abc.jambo.com
    .*amazon.com.*                                     amazon.com
    Abc.com                                            Abc.com
    xyz.Abc.com                                        xyz.Abc.com
    ^http://bhido.jambo.com/ababs/kd.htm               bhido.jambo.com

Maybe you are looking for

  • Problems with Re-Installation of Adobe Creative Suite 5 Design Standard (update from Premium)?

    Dear Community, after having initialized my Harddisk and upgraded my iMac to OS X Yosemite Vers 110.10.2 I found out that my CD both from the Original CS Premium and the update to CS 5 Design Standard I now cannot load these applications anymore. The

  • How to do GAP analysis ?

    Hi Experts, How to do GAP analysis ? I have a BW problem statement about SD module. I have to do a GAP analysis. I am doing it for the first time. So any suggestion about the approach to start it ? Thanks

  • SSRS Install Question

    I have a very simple SharePoint 2013 setup, 2 web servers, 2 app servers, and one SQL 2012 SP1 server. I have been asked to integrate SSRS into the farm. My DBA has installed SSRS in integrated mode on the SQL server. However when I run Install-SPRSS

  • Multi-Camera Music Video

    Hi, Thanx in advance for your help. We did a multi-camera shoot of a band.  We ran through the set twice with 4 cameras, thats a total of 8 tracks.  The 2nd run through for the stationary camera on the drummer can be dropped to reduce the count to 7.

  • Why is it putting audiobooks in my regular music section???

    ok..well..its not an audiobook...it a comedy cd. but..when it put it on my comp. it automatically chose audiobooks as the catergory. thats fine with me...but there is nothing in my audiobook catergory..everything is in my regular music section. ho do