-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible to match and replace a string using this library? #24
Comments
Not sure if i understood correctly, but do you mean something like this?
|
@proditis yes, though I actually need My interpretation is The format I am used to is
|
@codecowboy it appears i messed up the example a bit. The correct example should read
Not quite sure how i managed to mess up the preg_replace in such a way :) (sorry about that)
For the random result from a separate query, you'd have to be a bit more specific. Is this a new "random" value for each record or one random value for all the
or
I hope this cleared things up a bit. |
@proditis thanks very much. I will get back to you on the above. I also tried something like this as an experiment:
I tried to adapt this from the example in the docs:
BUT I get unknown column 'post_content' (it is DEFINITELY in the wp_posts table). Any ideas? |
You're missing the
|
I've installed the library but am unsure how I would go about altering this
SELECT
statement to use PREG_REPLACESELECT meta_value FROM wp_postmeta WHERE meta_key ="_videoembed_manual";
How would I combine the above statement with UPDATE to replace actual values in the DB? I want to change a substring of meta_value with a different URL. I'm just wondering if these functions will avoid me having to write a separate script. This is a one-off task so I'm not too bothered that regex is not the approporate way to parse HTML (the url is within some HTML in the
meta_value
field)The text was updated successfully, but these errors were encountered: