[thelist] MySQL REGEXP Help

r937 rudy at r937.com
Thu Feb 14 19:08:14 CST 2008


> i think this has it fixed now.

hmmm, try this -- 

      create table joel
      ( id integer not null primary key auto_increment
      , foo varchar(99)
      );
      insert into joel (foo) values
       ( 'the moon.The dish' )
      ,( 'one thing leads to another' )
      ,( 'one thing.another' )
      ,( 'curly, larry, and moe' )
      ,( 'shemp, joe,and curley joe' )
      ,( 'one.two' )
      ,( 'one!three' )
      ;

okay, that's the test bed

maybe i didn't undertand the backslash-w, but now please try this --
      
      select id
           , foo
           , foo regexp '\.\w' as michael
           , foo regexp '[[:punct:]][[:alnum:]]' as rudy
        from joel

see, here's what i get....

id  foo                       michael  rudy   
 1  the moon.The dish            0       1    
 2  one thing leads to another   0       0    
 3  one thing.another            0       1    
 4  curly, larry, and moe        0       0    
 5  shemp, joe,and curley joe    0       1    
 6  one.two                      1       1    
 7  one!three                    0       1    

your mileage may vary, eh     ;o)

best regards

rudy




More information about the thelist mailing list