Bernhard Kraus
Bernhard Kraus

Reputation: 329

MySQL Regexp find href with space at the end

There is a column in a MySQL table that stores HTML code.

Unfortunately some link hrefs end with a space like

...some code...<a href="/path/further-path/and-more-path "...>some-text</a>...some code...

Now I have to find each column row that have such a link in its content column.

Tried some regexp select:

content REGEXP '.+href="[a-zA-Z0-9/\-][[:space:]]".+'
content REGEXP '.+href="[a-zA-Z0-9/\-]( )".+'

With and without the .+ but none of them find anything that fits. I am sure that there are entries containing such links ;).

Please help. I am not a regex guru at all.

Upvotes: 0

Views: 369

Answers (1)

Toto
Toto

Reputation: 91488

You're missing a + quantifier:

content REGEXP '.+href="[a-zA-Z0-9/\-]+[[:space:]]".+'
#                              here __^

Upvotes: 1

Related Questions