473,387 Members | 3,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

MySql REGEXP Problem

I've been using regular expressions for a few months, but I've hit a problem I can't figure out. I need a MySQL regexp to match a string made up of a sequence of characters occurring only 0 or 1 times. For example, for characters 'a', 'b', and 'c', I want to match to 'a', 'b', 'c', 'ab', 'ac', 'ba', 'bc', 'ca', 'cb', 'abc', 'acb', 'bac', 'bca', 'cab', 'cba', and nothing else.

My problem is that I'm getting things like 'abcd' showing up because the 'abc' pattern is in there, but I want to match to an exact string, not a pattern existing somewhere in the string. I've gone thought dozens of different regular expressions and I can't get what I'm looking for. Any suggestions?
Sep 22 '08 #1
1 2044
coolsti
310 100+
\b is a whole word break inidicater, meaning that

Expand|Select|Wrap|Line Numbers
  1. \babc\b
  2.  
should match abc which is not part of any string. You could maybe wrap the rest of your regexp expression in the \b tags.
Sep 22 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Martin Lucas-Smith | last post by:
Can anyone point me to a regular expression in PHP which could be used to check that a proposed (My)SQL database/table/column name is valid, i.e. shouldn't result in an SQL error when created? ...
1
by: denisb | last post by:
hello all, for a search engine, I'm looking for a regexp than can do the job it is just (!) a 's' problem (frequent in french) : I have a field 'thesaurus' in a table MySQL (3.23.56) ; I...
0
by: Simon | last post by:
Hi, I have a table with a column that contains many names, like "Ant Simon Lucy", if I was looking for one name in the string of names I would do... SELECT * from classroom where name LIKE...
1
by: jlee | last post by:
I'm pretty much a newbie on mysql, and I need some help. I am running mysql Ver 12.22 Distrib 4.0.24, for portbld-freebsd5.4 (i386) on a server hosting an active website. The site's developer...
4
by: kristian | last post by:
Hi. According to this text from http://dev.mysql.com/doc/refman/5.0/en/fulltext-boolean.html mysql supports the * like this 'apple*' "Words match if they begin with the word preceding the *...
7
by: Csaba Gabor | last post by:
I need to come up with a function function regExpPos (text, re, parenNum) { ... } that will return the position within text of RegExp.$parenNum if there is a match, and -1 otherwise. For...
1
by: diwe | last post by:
Hello I make an regexp select statement over two tables. The Result set comes Back without errors. But If I look into the resultSets sometimes the ColumnName is Missing. Anyone knows about this...
2
by: ElkGroveR | last post by:
Hi there! I'm using PHP to create a simple, dynamic MySQL SELECT query. The user chooses a selection from a HTML Form SELECT element's many options and submits the form via a POST action. ...
1
by: Good Man | last post by:
Hi there If I have a "Filename" column in a database, and I want to grab the EXTENSION of this filename... can I do it in a query using REGEXP or something similar? I've got this going: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.