Search
Other DB Replacer questions
Forum

regex to delete the value of a given custom field

Marc's Avatar Marc
Hi Peter & co,

I wanted to delete the value of a given custom field (with ID 6) for some Articles (with ID < 101)

So I was quite confident that the following would work:

table = fields_value
column = value
where = field_id=6 AND item_id<101
search = ^http
regex = ON
replace = test

but in the "preview" at the bottom of the screen, it seems to simply replace
http
by
test
, not "the whole string" by
test
(and actually what I want to do is not to replace by "test" but by "", ie empty string)
Peter van Westen's Avatar Peter van Westen ADMIN
That is expected behavior.
^http
Will math 'http' if it is at the start of the string.

If you want to match the entire string, only if it starts with 'http', then do:
^http.*

If you want to empty it regardless of the value (and just rely on the WHERE filters), then just enter:
*
(no Regular Expressions)
Please post a rating at the Joomla! Extensions Directory
Marc's Avatar Marc
The regex works! Thank you so much 🙂

But without regex, just putting * would also display 33 results... but the preview seemed totally wrong

See the difference

- with regex


- without regex
Peter van Westen's Avatar Peter van Westen ADMIN
It is not a bug. When searching for '*', DB Replacer will only show the replacement text if it is 50 characters or less.
This is to prevent long and unreadable results in the preview.
Please post a rating at the Joomla! Extensions Directory
Marc's Avatar Marc
oh, interesting.
I did not dare executing * bc of the weird appearance in the preview, I was not aware of this subtlety
Txs again for everything.
Issue closed 🙂
Peter van Westen's Avatar Peter van Westen ADMIN
Please try the latest development version from:
regularlabs.com/development-releases

Should now look something like this instead for long results:
Please post a rating at the Joomla! Extensions Directory
Marc's Avatar Marc
oh, very smart, txs a lllot Peter, as always 🙂
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription