Jump to content

A little query help needed, thanks


Recommended Posts

I am trying to change this

[sharedmedia=core:attachments:****]

into this

[ATTACH]****[/ATTACH]

And leave the same numbers intact, the *s are unique numbers per post.

Thanks for any help!
 

 

Edited by indie
Link to post
Share on other sites

:psychic:

Could create a second BBCode tag that turns [attach] into [sharedmedia], so both tags would be supported. Actually I rather suggest that in case there's something still using or generating [sharedmedia]s - wouldn't want to break those. Would also mean not having to deal with the database.

If you have a more specific question, like what code you have to write or regular expression to create, then you should probably ask that.

Link to post
Share on other sites

Unfortunately nothing, that's why I am asking. This is not my skill department. But I can surely paste a query lol.

What I need is a regex code to change the above. So where the **** would be 6453, in the below code, the **** would also be 6453. So all it keeps is the attachment number. Thanks!

Link to post
Share on other sites

Creating the regex is fairly straightforward: start with the literal string you want to find, escape any special characters that you don't want to be special (like the [ ]s), then substitute in stuff like (\d+) where you want to find numbers. The replacement string works much the same way, and you can reference the matched numbers from before using $1 or \1 (careful of the backslash).

Honestly, you're probably overestimating how difficult this will be.

Link to post
Share on other sites
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.