Cable Forum

Cable Forum (https://www.cableforum.uk/board/index.php)
-   General IT Discussion (https://www.cableforum.uk/board/forumdisplay.php?f=19)
-   -   Mysql help [find/replace] (https://www.cableforum.uk/board/showthread.php?t=33674177)

Kymmy 24-01-2011 14:32

Mysql help [find/replace]
 
Is there any way in the regular expresion for doing a "any character" find

In other words if I want to search for any word beginning with A and ending in Z but with any two characters inbetween for example A12Z or AcdZ or A:3Z is there any way of doing it..

Just thought I;d ask as I do have a way of doing it to an SQL dump but wanted to know if I could do it directly via either command line or phpmyadmin

Wicked_and_Crazy 24-01-2011 14:39

Re: Mysql help [find/replace]
 
select * from tablename where columnname like 'A%%Z'

Kymmy 24-01-2011 15:02

Re: Mysql help [find/replace]
 
Cool :) will give it a try

Thank you

Paul 24-01-2011 15:06

Re: Mysql help [find/replace]
 
You dont need 2 %'s

Also note that that A%Z will match AxxZ or AZ or AxxxxxxxxxZ

If you want it to be just two chars use _ i.e. A__Z

Wicked_and_Crazy 24-01-2011 15:35

Re: Mysql help [find/replace]
 
Quote:

Originally Posted by Paul M (Post 35157892)
You dont need 2 %'s

Also note that that A%Z will match AxxZ or AZ or AxxxxxxxxxZ

If you want it to be just two chars use _ i.e. A__Z


Whoops, didnt mean to put two % in (although it would still work). Must admit i had assumed that the column was 4 chars in width

Kymmy 24-01-2011 15:43

Re: Mysql help [find/replace]
 
Paul, thank you very much, exactly what I was after..


All times are GMT +1. The time now is 09:03.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum