indie 0 Posted February 6 Share Posted February 6 (edited) 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 February 6 by indie Quote Link to post Share on other sites
requinix 977 Posted February 6 Share Posted February 6 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. Quote Link to post Share on other sites
indie 0 Posted February 7 Author Share Posted February 7 Not two codes no. Yes, looking for regex to take care of it. Quote Link to post Share on other sites
requinix 977 Posted February 7 Share Posted February 7 What have you been able to come up with so far, and what happened/didn't happen when you tried it? Quote Link to post Share on other sites
indie 0 Posted February 8 Author Share Posted February 8 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! Quote Link to post Share on other sites
requinix 977 Posted February 8 Share Posted February 8 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. Quote Link to post Share on other sites
indie 0 Posted February 9 Author Share Posted February 9 That's all Greek to me. Looking for someone to post it for me, can pay. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.