mlsamuelson.com

RLIKE - use Regex in MySQL SELECT statements

SELECT title FROM periodicals WHERE title RLIKE '^National .* Weekly$';

match all rows where title starts with 'National' and ends with 'Weekly' with anything in between

Matches
National Work Workers Weekly
National Policy Review Weekly
Nationalist Critique Weekly

Not
National Lampoon Magazine
Mountaineering Weekly

No comments

Add your comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

Find Me Around

User login