Facebook – https://www.facebook.com/TheNewBoston-464114846956315/ GitHub – https://github.com/buckyroberts Google+ …
Original source
Facebook – https://www.facebook.com/TheNewBoston-464114846956315/ GitHub – https://github.com/buckyroberts Google+ …
Original source
42 responses to “MySQL Database Tutorial – 15 – Regular Expressions”
That was helpful
YOUR SKILLS ARE AWESOME LIKE YOU BUCY ROBERTS::::!!!@
This lessons were made after "SOLOLEARN" ?. Or..is it the other way around? https://www.sololearn.com/Play/SQL
regex is powerful. excellent tutorial. thanks
What is the difference between the dot wildcard and the % wildcard then? It looks like both will return the same results. %boxes = .boxes right?
is that really you? 😀
http://prntscr.com/hd67oj
In Oracle the fist example would be like:
SELECT name FROM items WHERE REGEXP_LIKE(name, 'new');
or
SELECT name FROM items WHERE REGEXP_LIKE(name, 'New');
considering that the Oracle Database is case sensitive, all the other examples works using this same structure.
Take a drink every time Bucky says "regular expressions".
1 question, why this query only output '7 boxes of frog'? instead of '7' and '48' b.o.f.
SELECT name FROM items WHERE name REGEXP '[^12358] boxes of frogs'
use this code to negate entire Regular Expression:-)
SELECT name FROM items WHERE name NOT REGEXP 'BOXES OF FROGS'
LIKE & REGEXP ain't used in the battlefield , they lower the performances
SELECT * FROM this_channel WHERE content REGEXP 'awesome'
it pulled up all your videos
Turn on CC and those won't be frogs anymore :)) (did that by accident while pausing)
To search for any boxes with any number, try this guys
…. REGEXP '[0-9] boxes'
It will show all the boxes with some numbers before it.
Where is the file (items)?
i can't find it
3:12 Take a look at our resarts XD
well , what if i want to search for REGEXP "car" in the Title column and in the Content column …?
*EDIT:I JUST TRIED THIS AND IT WORKED*
SELECT * FROM `articles` WHERE
(author REGEXP 'Hello')
OR (title REGEXP 'Hello')
OR (content REGEXP 'Hello')"
Thanks
REGEXP '[12345] boxes of frogs' would return 3 boxes… but would it also check for 12 23 34 45 123 234 345 1234 2354 and 12345
BUT what to do if we want to search number 19 or 20 0r 21 ???? 0-o
This is the most boring tutorial since the first 14 tutorial. The first 14 was fun, but this one was really boring.
For LINUX user (maybe other else) , I found REGEXP works a little different here:
Take this word 'bookkeeper' for example
, you can't use [REGEXP 'bo{,2}k{,2}e{,2}per] << (In linux REGEXP could do this.)
, you have to use [REGEXP 'bo{0,2}k{0,2}e{0,2}per]
to match the word.
@ 4:49 , what if I wanted to return 1 boxes of frogs, 23 boxes of frogs and 45 boxes of frogs? …I understand it as allowing those chars from the ascii char index… so all these would be possible:
1 box, 2, 3, 4, 5, 11, 12, 13, 14, 15, 21, 22, 23, 24, 25, …44, 45, 111… etc any number able to be made with those 5 numbers?
Hey bucky, how do you give the regular expression if the number of frogs to be returned are 48,49,50,51? You gave single digit case, what if there are two digit or higher numbers to test?
Hey, +thenewboston, how do I stop PHPMyAdmin from automatically putting that "LIMIT 0, 30" in every freaking query??
Great video!
You can do so by leaving spaces between numbers.
SELECT name
FROM items
WHERE name REGEXP '[1 2 3 4 5 48] boxes of frogs'
This will output:
————————
name
3 boxes of frogs
48 boxes of frogs
right. so if you need boxes that have more than 9 frogs you type:
'[1-9][1-9] boxes of frogs'
as this means everything from 10 – 99. regular expressions work only for single chars at a time so you cant seach for "10 to 29" but you can search for first number: [12], second number [0-9].
lolz
2:25 *cough* PENIS! *cough*
It works as well using commas:
REGEXP[10,11,12,13];
Thank you Bucky love ya
ehm… maybe… '[10-43] boxes…'
Lol your tutorials are extremely helpful + very entertaining !!
Quick Question, Are Regular Expressions used in Microsoft SQL Server' 2008 R2? Thank you!
You cannot do more than one integer, even with space and parenthesis. Trust me. The parenthesis are only supposed to represent one character, but feel free to combine them Everyone else should stop answering based off guesses, it is very misleading for people who are really trying to learn here.
All you have to do is use your brain and think for a moment about what you learned earlier in the tutorials or just math in general. Use parentheses, i.e " (48) ". It's pretty self explanatory.
If people are still wondering about this , think about the set between the [] as a char array rather than an integer array . So like if you want to get an item like "48 boxes of frogs" , you could just do REGEXP '[0-9] boxes of frogs' , as only 8 is needed for it to be returned . A more practical example would be trying to do REGEXP '[abc….xyz]word' . In this case , it would get all the entries that start with any letter of the alphabet , + "word" (aword , bword , cword etc) .
"Regular Expressions are pretty much taking all the symbols on your keyboard that you thought you'll never use and putting them to use." Bamm…….
You'd be surprised.
man cock? really? Is there something called a woman cock?
2:27 >> he show me man cock