I feel very lost in solving one simple (I guess) task. I have a table which contains links in the following format: /text(or any character)/, /text(or any character)/text1(or any character), http://domain.tld/text/text1 and so on... I want to list (select) only the links which are in the following format: /text(or any character)/text1(or any character) I tried with the following rules:
select href from table
where href not like '%http%'
and href REGEXP '^[/][a-zA-Z](/)[a-zA-Z]'
Empty set (0.00 sec)
select href from table
where href not like '%http%'
and href REGEXP '^[/][a-z](/)%';
Empty set (0.00 sec)
Kindly help with that. Thank you!
^[/][a-zA-Z]+(/)[a-zA-Z]+and^[/][a-z]+(/).$to the end of it makes sure the end of the regex matches the end of the string. But Wiktors answer handles all that. You should use his solution (he's the maestro ;).%is forLIKE. In aREGEXP,%stands for itself.