DB Replacer

Include value of column eg alias in Replace string?

6 months 2 weeks ago #76557

Trevor Bennett's Avatar Trevor Bennett

I am searching for text like [Note 1-12] using eg \[Note [0-9]{1,2} in fulltext, in a range of articles, limited in Where by catid and expressions like right(alias,3) resulting in a numeric string like '049'
and need to Replace the result of the search in many rows by eg {modal article=049-$0}049.$0{/modal}, to give the content of the individual numbered Notes article alias=049-1 as a modal pop-up, link=[Note 049.1]

I tried eg {modal article=right(alias,3)-$0}right(alias,3).$0{/modal} but unsurprizingly this shows in the Preview, [Note 1{modal article=right(alias,3)-[Note 1}right(alias,3).[Note 1{/modal} ie including that literal text 'right(alias,3)'

-can I instead get the value of that function?
- would this be any easier using eg your rereplacer extension, free or pro? I realize that rereplacer does a "temporary" change ie not of the actual content html, but this may be OK with the site owner.


6 months 2 weeks ago #76559

Peter van Westen's Avatar Peter van Westen Admin

You cannot use the value of other columns in your replacement.
You can only use the stuff that you can find in the search field.

6 months 2 weeks ago #76561

Trevor Bennett's Avatar Trevor Bennett

OK. that's what it looked like in the documentation. I shall try inserting my nnn, owner's local serial number, bit of alias into the fulltext, after the '[Note ' string, in every appropriate article first, using Plain Old PHPMySQL, and use DB Replacer to test and insert the Note number, {modal}{/modal} syntax etc for the multiple occurrences of numbered Notes that may be found within the article(s), not so easy in SQL!
WHEN I get it all working, I will give you a link to view the resulting conversion of notes from Printed book-style Footnotes to a more dynamic Web presentation...!

6 months 2 weeks ago #76608

Trevor Bennett's Avatar Trevor Bennett

I continue to have problems with SQL syntax dialect differences between PHPMyAdmin and ?DB Replacer ... I inserted the extra "serial number" into around 70 articles using SQL, and now have eg [Note 049.1] available in the fulltext of the article at http://http://songsfromtheageofsteam.uk/comic-tales/150-bar049, see source code
But I have searched in vain using DB Replacer for this string so that I can wrap it in {modal article = note-049-1} {/modal} , this working well at eg
songsfromtheageofsteam.uk/other-rivers-before-1851/57-bar666 , done by manual editing to popup the extracted Note articles.
I tried your example syntax in tutorial eg (\$[0-9]+\.[0-9][0-9]) but every variation I have tried produces either Search string not found or invalid query errors. I tried alternative ways of finding 049.1 eg [0-9]{3}[0-9]{1,2} to allow for note numbers above 9, but with no advances. I changed the square brackets to < > in case I was having special character problems, at the above url ie songsfromtheageofsteam.uk/comic-tales/150-bar049 ; my DB R search, screen print attached

Can you help please? It would be helpful also if the admin screen could retain the field values for Where/Search/Replace/Regex in a cache at least during a Joomla session; going to chaeck the text of an article wipes them and my attempts to collect them via screenprints or Notepad notes are very frustrating!
I can give you S admin access eg (hidden text)
Confidential information:
if you have time.

6 months 1 week ago #76611

Peter van Westen's Avatar Peter van Westen Admin

In your search you seem to be looking for <Note ...> syntax instead of square brackets: [Note ...].

\[Note ([0-9]{3,})\.([0-9]+)\]
{modal article="\1-\2"}
That will convert:
[Note 123.45]
{modal article="123-45"}
The '123-45' format should match your aliases.

6 months 1 week ago #76629

Trevor Bennett's Avatar Trevor Bennett

Looks like you have cracked it for me with syntax I could not have come up with , even with "Regex for Dummies" at hand! (I wish...)