Search
Other DB Replacer questions
Forum

Regular expression for Article anywhere

Jacob Hodara's Avatar Jacob Hodara
Hi
I was using below regx
(\{article(?:-[a-z0-9-_]+)?) ([a-zA-Z0-9-_]+)\}
Replace with
\1 title="\2"}
from the doc for article anywhere alias change
DB replace show error The database query is invalid. Try changing the search.
On debug found : 1139 Got error 'repetition-operator operand invalid' from regexp

i have to replace article title and alias for Joomla 4 article anywhere version.

Thank you
Peter van Westen's Avatar Peter van Westen ADMIN
What database type and version are you using?
Please post a rating at the Joomla! Extensions Directory
Jacob Hodara's Avatar Jacob Hodara
Hi
its mysql
Database Type mysql
Database Version 5.7.44
Database Collation latin1_swedish_ci
Database Connection Collation utf8mb4_general_ci
Database Connection Encryption None
Database Server Supports Connection Encryption Yes
PHP Version 8.1.24
Web Server Apache
Peter van Westen's Avatar Peter van Westen ADMIN
I don't know. Should be working fine. The syntax is correct.

Can you give me (super) admin and (s)ftp access so I can take a look?
You can use the 'Confidential information' button in the forum editor to hide sensitive information.
Please post a rating at the Joomla! Extensions Directory
Jacob Hodara's Avatar Jacob Hodara
Confidential information:
(hidden)

Credentials added. for FTP please use FF explorer extesnion. Using latest version of DB Replacer
Peter van Westen's Avatar Peter van Westen ADMIN
It seems your version of mysql has an old or weird implementation of Regular Expressions.

You need to escape the '-' characters. And the '?:' part can't be used.

So you could run this search in 2 parts:
(\{article\-[a-z0-9\-_]+) ([a-zA-Z0-9\-_]+)\}
and:
(\{article) ([a-zA-Z0-9\-_]+)\}

But both are not found in your article contents.
Please post a rating at the Joomla! Extensions Directory
Jacob Hodara's Avatar Jacob Hodara
Hi
Any other way to search replace as short code used with Alias and article title.
{article standard-heritage-information}
Peter van Westen's Avatar Peter van Westen ADMIN
For some reason it is not matching how it should with the '}' characters in the search. Again, I think it is down to the mysql version (and it's Regular Expressions implementation).

But you can search for this (with case-sensitive option on). It is probably unique enough:
(\{article) ([a-z0-9\-_]+)
Replace with:
\1 alias="\2"}
Please post a rating at the Joomla! Extensions Directory
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription