Re: regexp in conditional

2014-01-07 Thread Larry Martell
On Tue, Jan 7, 2014 at 12:33 PM, Michael Dykman wrote: > I think you just have a misplaced parenthesis. try: > SELECT IF(r REGEXP '^ED[HMUZ][0-9]$', 'yes', 'no') FROM s; Yes, thanks! > > > > On Tue, Jan 7, 2014 at 2:22 PM, Larry Martell wrote: > >> Can I use an regexp in a conditional?

Re: regexp in conditional

2014-01-07 Thread Larry Martell
On Tue, Jan 7, 2014 at 12:31 PM, Peter Brawley wrote: > > On 2014-01-07 1:22 PM, Larry Martell wrote: >> >> Can I use an regexp in a conditional? I need to do something like this: >> >> SELECT (IF r REGEXP '^ED[HMUZ][0-9]$', 'yes', 'no') FROM s; >> >> I'm getting an error from that. Is there some

Re: regexp in conditional

2014-01-07 Thread Michael Dykman
I think you just have a misplaced parenthesis. try: SELECT IF(r REGEXP '^ED[HMUZ][0-9]$', 'yes', 'no') FROM s; On Tue, Jan 7, 2014 at 2:22 PM, Larry Martell wrote: > Can I use an regexp in a conditional? I need to do something like this: > > SELECT (IF r REGEXP '^ED[HMUZ][0-9]$', 'yes

Re: regexp in conditional

2014-01-07 Thread Peter Brawley
On 2014-01-07 1:22 PM, Larry Martell wrote: Can I use an regexp in a conditional? I need to do something like this: SELECT (IF r REGEXP '^ED[HMUZ][0-9]$', 'yes', 'no') FROM s; I'm getting an error from that. Is there some way to do this? SELECT IF( r REGEXP '^ED[HMUZ][0-9]$', 'yes', 'no' ) F

Re: REGEXP and unicode weirdness

2010-01-21 Thread fsb
On 1/21/10 10:27 AM, "John Campbell" wrote: > I want to find rows that contain a word that matches a term, accent > insensitive: I am using utf8-general collation everywhere. > > attempt 1: > SELECT * FROM t WHERE txt LIKE '%que%' > Matches que qué, but also matches 'queue' > > attempt 1.5: >

Re: REGEXP and unicode weirdness

2010-01-21 Thread Paul DuBois
On Jan 21, 2010, at 9:27 AM, John Campbell wrote: > I want to find rows that contain a word that matches a term, accent > insensitive: I am using utf8-general collation everywhere. > > attempt 1: > SELECT * FROM t WHERE txt LIKE '%que%' > Matches que qué, but also matches 'queue' > > attempt 1

Re: REGEXP help Finding phone numbers (nnn) nnn-nnnn format

2008-12-03 Thread wim . delvaux
On Wednesday 03 December 2008 08:39:54 Paul Nowosielski wrote: > Hi, > > Please, can anyone lend a hand in helping pullout > phone numbers from the DB that only match > the format (nnn) nnn- ? "("[0-9]{3}") "[0-9]{3}-[0-9]{4} I think HTH W > SELECT phone_work FROM leads WHERE phone_work REGEX

Re: REGEXP help Finding phone numbers (nnn) nnn-nnnn format SOLVED

2008-12-03 Thread Paul Nowosielski
This seems to do it: SELECT phone_work FROM leads WHERE phone_work REGEXP '[(]{1}([0-9]){3}[)]{1}[ ]?([^0-1]){1}([0-9]){2}[ ]?[-]?[ ]?([0-9]){4}' - Original Message From: Paul Nowosielski <[EMAIL PROTECTED]> To: mysql@lists.mysql.com Sent: Wednesday, December 3, 2008 2:39:54 PM Subjec

RE: REGEXP vs LIKE/OR

2008-08-15 Thread emierzwa
It looks like "LIKE" is only slightly faster(on my XP), hardly worth mentioning. Go with what is easier for you to read or for portability if you need it. IMHO set @a='gfdueruie baz hdhrh';select BENCHMARK(500, (select 1 from dual WHERE @a LIKE '%foo%' OR @a LIKE '%bar%' OR @a LIKE '%baz%')) a

Re: regexp negate string help

2007-09-25 Thread Baron Schwartz
MySQL's regex library doesn't have all those Perl features. You can use the pcre-compatible extension from http://www.xcdsql.org/MySQL/UDF/, or just use two clauses in the WHERE: one should be col NOT RLIKE "linux$" Baron Tang, Jasmine wrote: Hi, I need to match anything that start with "

Re: REGEXP Character Classes

2007-05-02 Thread Paul DuBois
At 5:33 AM -0400 5/2/07, John Kebbel wrote: I went to the MySQL documentation pages and read up on using COLLATE. I knew SELECT was case-insensitive, but I was sort of surprised that using a character class didn't override that. Anyway, I next tried the "status" command to see if it gave me any c

Re: REGEXP Character Classes

2007-05-02 Thread John Kebbel
to > [EMAIL PROTECTED] > > > > > To > MySQL > >cc > > Subject > Re: REGEXP > Character Classes > > > > > > > > > I went to the MySQL documentation pages and read up on using COLLATE. > I >

Re: REGEXP Character Classes

2007-05-02 Thread John Kebbel
I went to the MySQL documentation pages and read up on using COLLATE. I knew SELECT was case-insensitive, but I was sort of surprised that using a character class didn't override that. Anyway, I next tried the "status" command to see if it gave me any characterset information. Client characterset:

Re: REGEXP Character Classes

2007-05-01 Thread Paul DuBois
At 6:20 PM -0400 5/1/07, John Kebbel wrote: Linux Version: Linux version 2.6.15-28-386 MySQL Version: 5.0.22-Debian_0ubuntu6.06.3-log I have two queries using REGEXP character classes and their respective outputs below. The first is supposed to match an upper case character in a column, but I w

Re: REGEXP word boundary problem

2005-03-24 Thread Jigal van Hemert
From: "Paul Groves" > The main con for me is that it won't index words of three characters > (which I think I will in my queries) or less unless I change the default > server setting (can you do this on a by database basis?), which may be > possible, but it depends where its finally hosted... You

Re: REGEXP word boundary problem

2005-03-24 Thread Paul Groves
Jigal van Hemert wrote: From: "Paul Groves" BTW is there anyway to speed up the search, as I think this may be pretty slow (there will be about 25000 records in the real database...) e.g. maybe by doing a LIKE match for "%elbow%" first then doing a REGEXP within that? Not sure how one would code th

Re: REGEXP word boundary problem

2005-03-24 Thread Usha
t; <[EMAIL PROTECTED]> To: "Jigal van Hemert" <[EMAIL PROTECTED]> Cc: "Paul Groves" <[EMAIL PROTECTED]>; Sent: Thursday, March 24, 2005 5:47 PM Subject: Re: REGEXP word boundary problem > Jigal van Hemert wrote: > > From: "Paul Groves"

Re: REGEXP word boundary problem

2005-03-24 Thread Jigal van Hemert
From: "Paul Groves" > BTW is there anyway to speed up the search, as I think this may be > pretty slow (there will be about 25000 records in the real database...) > e.g. maybe by doing a LIKE match for "%elbow%" first then doing a REGEXP > within that? Not sure how one would code the SQL for that,

Re: REGEXP word boundary problem

2005-03-24 Thread Paul Groves
Paul Groves wrote: Jigal van Hemert wrote: From: "Paul Groves" SELECT * FROM object WHERE description REGEXP '[[:<:]]elbow[[:>:]]'; There are records in the object table that have the following description fields (as test data): elbows ligaments elbowed ligaments My elbow elbow joint Whose elbow is

Re: REGEXP word boundary problem

2005-03-24 Thread Paul Groves
Jigal van Hemert wrote: From: "Paul Groves" SELECT * FROM object WHERE description REGEXP '[[:<:]]elbow[[:>:]]'; There are records in the object table that have the following description fields (as test data): elbows ligaments elbowed ligaments My elbow elbow joint Whose elbow is that The query sho

Re: REGEXP word boundary problem

2005-03-24 Thread Jigal van Hemert
From: "Paul Groves" > SELECT * FROM object WHERE description REGEXP '[[:<:]]elbow[[:>:]]'; > > There are records in the object table that have the following > description fields (as test data): > > elbows ligaments > elbowed ligaments > My elbow > elbow joint > Whose elbow is that > > The query sho

Re: REGEXP and word boundary match

2004-06-27 Thread Luke Majewski
Paul DuBois wrote: Why do you think this? That's not what the regex chapter in the MySQL manual says. \b works in Perl, but MySQL isn't Perl. I looked through the pattern matching section and didn't see what you linked below. The easiest way to find out the correct syntax is to look in the MySQ

Re: REGEXP and word boundary match

2004-06-27 Thread Paul DuBois
At 19:14 -0400 6/27/04, Luke Majewski wrote: Hi All, I have fields like: "Washable Velour Doll" in my database and I want to do a boundary match so that when people enter a search field like "Velour" I return all instances where the whole word exists. In other words, 'lour' would not work. I kn

Re: REGEXP with UTF-8

2004-04-06 Thread Sergei Golubchik
Hi! On Apr 07, Hirofumi Fujiwara wrote: > > From: Sergei Golubchik <[EMAIL PROTECTED]> > > Hi! > > > > On Apr 06, Hirofumi Fujiwara wrote: > > > > > > I am testing regular expression feature of MYSQL 4.1.1-alpha > > > (REGEXP) with UTF-8 characters (Japanese). So far it doesn't > > > seem to w

Re: REGEXP with UTF-8

2004-04-06 Thread Hirofumi Fujiwara
From: Sergei Golubchik <[EMAIL PROTECTED]> > Hi! > > On Apr 06, Hirofumi Fujiwara wrote: > > > > I am testing regular expression feature of MYSQL 4.1.1-alpha > > (REGEXP) with UTF-8 characters (Japanese). So far it doesn't > > seem to work. > > > > LIKE handles each Japanese character properly

Re: REGEXP with UTF-8

2004-04-06 Thread Sergei Golubchik
Hi! On Apr 06, Hirofumi Fujiwara wrote: > > I am testing regular expression feature of MYSQL 4.1.1-alpha > (REGEXP) with UTF-8 characters (Japanese). So far it doesn't > seem to work. > > LIKE handles each Japanese character properly as one character, > but REGEXP doesn't. > > I'd like to know

RE: RegExp Help

2004-01-21 Thread jeffrey_n_Dyke
<[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> ve.com> cc: Subject: RE: RegExp Help

RE: RegExp Help

2004-01-21 Thread Bob Cohen
> >you should be able to use STR_REPLACE. > DOH. Sorry, there is NO STR_REPLACE its just REPLACE. > jd > > >update 02093_xdir_links SET title = REPLACE("*","",title); Thank you very much for responding. Sorry to be dense but will this SQL find only those records with data in the TIT

Re: RegExp Help

2004-01-21 Thread jeffrey_n_Dyke
>you should be able to use STR_REPLACE. DOH. Sorry, there is NO STR_REPLACE its just REPLACE. jd >update 02093_xdir_links SET title = REPLACE("*","",title); >hth >jeff "Bob Cohen" <[EMAIL PROTECTED]To: <[

Re: RegExp Help

2004-01-21 Thread jeffrey_n_Dyke
you should be able to use STR_REPLACE. update 02093_xdir_links SET title = REPLACE("*","",title); hth jeff "Bob Cohen"

Re: regexp with - '-' or "-" like phone numbers e.g: d-dd-d dd-dd-d ddd-dd-d dddd-dd-d

2003-11-08 Thread karthikeyan
atleast: d-dd-d 0-00-0 9-99-0 select count(*) from processes where `in` regexp "[0-9]{1}-[0-9]{2}-[0-9]{1 }"; for: 00-00-0 99-99-0 select count(*) from processes where `in` regexp "[[:space:]][0-9]{2}-[0-9] {2}-[0-9]{1}"; for 00-00-0, 99-99-0, select count(*) from processes where

Re: regexp with - '-' or "-" like phone numbers e.g: d-dd-d dd-dd-d ddd-dd-d dddd-dd-d

2003-11-08 Thread Jan Pieter Kunst
because '-' is understood as "from" - "to" e.g a-z, 0-9, etc., Escape the '-' with a backslash: '\-' JP -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: REGEXP emal address query

2002-12-14 Thread David T-G
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Richard -- ...and then Richard Baskett said... % % Ok finally found the answer after many hours of searching :) Here is the % MySQL query that works great! % % SELECT * FROM table_name % WHERE Email NOT % REGEXP "^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z

RE: REGEXP email address query

2002-12-10 Thread JamesD
ssage- From: Robert Citek [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 10, 2002 5:44 PM To: MySQL Subject: Re: REGEXP email address query Hello Richard, At 05:06 PM 12/10/2002 -0800, Richard Baskett wrote: >SELECT * FROM `table_name` WHERE Email REGEXP "^[@]"; >But I am doin

Re: REGEXP emal address query

2002-12-10 Thread Richard Baskett
Ok finally found the answer after many hours of searching :) Here is the MySQL query that works great! SELECT * FROM table_name WHERE Email NOT REGEXP "^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}" Thanks to all that replied! Rick "Keep away from people who belittle your a

Re: REGEXP email address query

2002-12-10 Thread Robert Citek
Hello Richard, At 05:06 PM 12/10/2002 -0800, Richard Baskett wrote: >SELECT * FROM `table_name` WHERE Email REGEXP "^[@]"; >But I am doing something wrong, because it's just not working :) You are searching for an Email field that begins with an @. Some alternatives: SELECT * FROM `table_name

Re: REGEXP

2002-10-13 Thread Paul DuBois
At 18:35 +0200 10/12/02, tl wrote: >Hello, > >mysql>LOAD DATA LOCAL INFILE 'access.log' INTO TABLE tmp FIELDS >TERMINATED BY 'REGEXP \"^[ ]{1,}$\"' OPTIONALLY ENCLOSED BY '' >ESCAPED BY ' ' LINES TERMINATED BY '\n' ; > >How can I make that it would work as I expected? >How terminate fields by s

Re: REGEXP question, newbie

2002-10-10 Thread Paul DuBois
At 16:04 -0400 10/10/02, Kevin wrote: >Another question...I know. Second one in 24 hours...I hate it too. > >I have a column of data that may begin with an open parenthesis "(". When I >do this: > > mysql> SELECT * FROM table WHERE column REGEXP "^(text"; > >I get this: > > ERROR 1139: Got

Re: REGEXP vs LIKE

2002-03-03 Thread Jeremy Zawodny
On Mon, Mar 04, 2002 at 02:42:46PM -0800, destr0 wrote: > filter fodder: mysql, database, sql > > whigh one is faster? > > REGEXP or LIKE? LIKE is generally faster. But LIKE can't do everything that REGEXP can, so that's probably no surprise. Jeremy -- Jeremy D. Zawodny, <[EMAIL PROTECTED]>

Re: REGEXP vs LIKE

2002-03-03 Thread Arjen Lentz
Hi, On Tue, 2002-03-05 at 08:42, destr0 wrote: > whigh one is faster? > REGEXP or LIKE? LIKE is an SQL language construct, REGEXP is a function. LIKE only uses two simple wildcards (_ and *). Provided your LIKE pattern does not start with a wildcard, the server will be able to use an index for i

Re: REGEXP and INDEX

2002-02-13 Thread Matthew Dougherty
The following is the piece describing LIKE and INDEX from the manual. The real question is does REGEXP use indexes. Using explain shows that it actually does, probably with the same rules as LIKE!!! Thanks for your help. MySQL also uses indexes for LIKE comparisons if the argument to LIKE is

Re: REGEXP and INDEX

2002-02-12 Thread Paul DuBois
At 18:07 -0800 2/10/02, Jeremy Zawodny wrote: >On Sun, Feb 10, 2002 at 02:53:53PM -0500, Matthew Dougherty wrote: >> If I use a REGEXP query on an indexed column using something like: >> Field REGEXP '^A|^B|^C' >> >> Will MySQL use the index like it would if I used Field LIKE 'A%' or >> Field

Re: REGEXP and INDEX

2002-02-12 Thread Jeremy Zawodny
On Sun, Feb 10, 2002 at 02:53:53PM -0500, Matthew Dougherty wrote: > If I use a REGEXP query on an indexed column using something like: > Field REGEXP '^A|^B|^C' > > Will MySQL use the index like it would if I used Field LIKE 'A%' or > Field LIKE 'B%' or FIeld LIKE 'C%' ?? It will not. Regular

Re: REGEXP and INDEX

2002-02-12 Thread Jeremy Zawodny
On Sun, Feb 10, 2002 at 10:01:45PM -0600, Paul DuBois wrote: > At 18:07 -0800 2/10/02, Jeremy Zawodny wrote: > >On Sun, Feb 10, 2002 at 02:53:53PM -0500, Matthew Dougherty wrote: > >> If I use a REGEXP query on an indexed column using something like: > >> Field REGEXP '^A|^B|^C' > >> > >> Will

Re: REGEXP and INDEX

2002-02-12 Thread Paul DuBois
At 21:30 -0800 2/10/02, Jeremy Zawodny wrote: >On Sun, Feb 10, 2002 at 10:01:45PM -0600, Paul DuBois wrote: >> At 18:07 -0800 2/10/02, Jeremy Zawodny wrote: >> >On Sun, Feb 10, 2002 at 02:53:53PM -0500, Matthew Dougherty wrote: >> >> If I use a REGEXP query on an indexed column using something

Re: REGEXP and INDEX

2002-02-10 Thread Paul DuBois
At 21:30 -0800 2/10/02, Jeremy Zawodny wrote: >On Sun, Feb 10, 2002 at 10:01:45PM -0600, Paul DuBois wrote: >> At 18:07 -0800 2/10/02, Jeremy Zawodny wrote: >> >On Sun, Feb 10, 2002 at 02:53:53PM -0500, Matthew Dougherty wrote: >> >> If I use a REGEXP query on an indexed column using something

Re: REGEXP and INDEX

2002-02-10 Thread Jeremy Zawodny
On Sun, Feb 10, 2002 at 10:01:45PM -0600, Paul DuBois wrote: > At 18:07 -0800 2/10/02, Jeremy Zawodny wrote: > >On Sun, Feb 10, 2002 at 02:53:53PM -0500, Matthew Dougherty wrote: > >> If I use a REGEXP query on an indexed column using something like: > >> Field REGEXP '^A|^B|^C' > >> > >> Will

Re: REGEXP and INDEX

2002-02-10 Thread Paul DuBois
At 18:07 -0800 2/10/02, Jeremy Zawodny wrote: >On Sun, Feb 10, 2002 at 02:53:53PM -0500, Matthew Dougherty wrote: >> If I use a REGEXP query on an indexed column using something like: >> Field REGEXP '^A|^B|^C' >> >> Will MySQL use the index like it would if I used Field LIKE 'A%' or >> Field

Re: REGEXP and INDEX

2002-02-10 Thread Jeremy Zawodny
On Sun, Feb 10, 2002 at 02:53:53PM -0500, Matthew Dougherty wrote: > If I use a REGEXP query on an indexed column using something like: > Field REGEXP '^A|^B|^C' > > Will MySQL use the index like it would if I used Field LIKE 'A%' or > Field LIKE 'B%' or FIeld LIKE 'C%' ?? It will not. Regular

Re: Regexp Help !!!

2002-01-13 Thread Tanton Gibbs
; "Beginners (E-mail)" <[EMAIL PROTECTED]> Cc: "*MySQL mail list" <[EMAIL PROTECTED]> Sent: Sunday, January 13, 2002 11:36 AM Subject: RE: Regexp Help !!! > > Thanks ! > > Glad I asked for some other thoughts on this. I totally over looked this >

RE: Regexp Help !!!

2002-01-13 Thread Jon Shoberg
To: Jon Shoberg; Beginners (E-mail) Cc: *MySQL mail list Subject: RE: Regexp Help !!! > -Original Message- > From: Jon Shoberg [mailto:[EMAIL PROTECTED]] > Sent: Sunday, January 13, 2002 4:47 PM > To: Beginners (E-mail) > Cc: *MySQL mail list; Jon Shoberg > Su

RE: Regexp Help !!!

2002-01-13 Thread Carsten H. Pedersen
> -Original Message- > From: Jon Shoberg [mailto:[EMAIL PROTECTED]] > Sent: Sunday, January 13, 2002 4:47 PM > To: Beginners (E-mail) > Cc: *MySQL mail list; Jon Shoberg > Subject: Regexp Help !!! > > > Ok, > > I have a list/database of words that follows as ... > > Top > ... > Top/A

Re: REGEXP and PHP Forms

2001-09-25 Thread Carl Troein
Nate Fowler writes: > Okay, I'm trying to make a form talk to a SELECT query using PHP. How do I > make input from a form become a PHP variable? This is explained in great detail in the PHP manual at http://www.php.net > "> > name="Submit" value="GO"> This looks

Re: REGEXP syntax

2001-07-27 Thread tj marlin
Mark: the key to this puzzle is the separator, the ';' for your first question, you need to find the ';' followed by a 6. not just any ';', but the first ';' the pattern would be "^[0-9]*;6" which says ^ find beginning of line [0-9]* followed by zero or more instance

Re: Regexp matching

2001-03-15 Thread Jeremy D. Zawodny
On Thu, Mar 15, 2001 at 08:50:01AM -0800, Mike DeWolfe wrote: > I'm having a problem with REGEXP : > > I have several rows that look like this : > > Health : health services : safety : physical abuse : women > Health : health services : safety : rescue > Health : health services : safety : sexua