It is currently May 20th, 2025, 8:27 pm



Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: If else condition for replacement.
PostPosted: April 18th, 2025, 3:58 am 

Joined: March 30th, 2015, 12:31 pm
Posts: 725
as i said earlier about imdb info issue. i thought may be this one could work.

if in the post imdb id post replacement function will work.

like if in the post found this keyword: tt0088414 and post has "0.0/10" and "N/A Votes"

replace
0.0/10=5.6
N/A Votes= 1.6K Votes

or could implement on themaposter only.


Top
 Profile  
Reply with quote  
 Post subject: Re: If else condition for replacement
PostPosted: April 18th, 2025, 4:26 am 
Site Admin
User avatar

Joined: March 10th, 2011, 11:14 pm
Posts: 13196
Location: Earth
You can already do this with replacement.

I would need full post message text example to write it and target correct places.

_________________
themaPoster | themaCreator | themaManager | themaLeecher | themaRegister


Top
 Profile  
Reply with quote  
 Post subject: Re: If else condition for replacement.
PostPosted: April 19th, 2025, 3:57 am 

Joined: March 30th, 2015, 12:31 pm
Posts: 725
as an example
Code:
Media Name.......: Daredevil: Born Again (2025)
iMDB Votes.......: N/A/10 (N/A Votes)
iMDB Link........: https://www.imdb.com/title/tt18923754/
Run Time.........: N/A
Genre............: Action / Adventure / Crime
Country..........: United States
Language.........: English
Writer...........: Bill Everett (characters), Stan Lee (characters)
Director.........: N/A
Cast.............: Charlie Cox, Margarita Levieva, Wilson Bethel


if text message has "tt18923754" then replace function will work for this following:

N/A/10 = 8.8/10
N/A Votes = 19K Votes


Top
 Profile  
Reply with quote  
 Post subject: Re: If else condition for replacement.
PostPosted: April 19th, 2025, 5:02 am 
Site Admin
User avatar

Joined: March 10th, 2011, 11:14 pm
Posts: 13196
Location: Earth
Search for:
Code:
(?si)N/A/10\s*\(N/A Votes\)(.+?tt18923754)


Replace with:
Code:
8.8/10 (19K Votes) $1


Enable regex search.

_________________
themaPoster | themaCreator | themaManager | themaLeecher | themaRegister


Top
 Profile  
Reply with quote  
 Post subject: Re: If else condition for replacement.
PostPosted: April 19th, 2025, 5:29 am 

Joined: March 30th, 2015, 12:31 pm
Posts: 725
thank you so much. one more edit please

<param=custom_fields[IMDB]=N/A/10 - N/A Votes>

here is the complete post.
https://pastebin.com/paPF0Prk


Last edited by Crackpot on May 6th, 2025, 5:13 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: If else condition for replacement.
PostPosted: April 19th, 2025, 2:51 pm 
Site Admin
User avatar

Joined: March 10th, 2011, 11:14 pm
Posts: 13196
Location: Earth
If the message is always in that format with "<param" just update the previous replacement to change both places at the same time (you should only have one replacement added which is below, not two - it won't work then):

Search for:
Code:
(?si)=N/A/10 - N/A\s*Votes(.+?)N/A/10\s*\(N/A Votes\)(.+?tt18923754)


Replace with:
Code:
=8.8/10 - 19K Votes$1 8.8/10 (19K Votes)$2


Enable regex search.

_________________
themaPoster | themaCreator | themaManager | themaLeecher | themaRegister


Top
 Profile  
Reply with quote  
 Post subject: Re: If else condition for replacement.
PostPosted: May 6th, 2025, 2:48 pm 

Joined: March 30th, 2015, 12:31 pm
Posts: 725
just a suggestion. wondering if could have if else search condition. dunno if it's hard to implement in TC, TP, TM or not

if i am not wrong if condition cannot be used in current TP replacement feature. probably need to add complete new method.

something like:

Code:
{if="tt18923754";normal_replace="N/A/10=8.8/10|N/A Votes=19 Votes|(N/A Votes)=(19K Votes)";reg_replace="reg replace condition"}


or may be use normal input box like TC has. sorry just an idea, i don't have any knowledge about coding so i don't know if it's possible to add or not.


Top
 Profile  
Reply with quote  
 Post subject: Re: If else condition for replacement.
PostPosted: May 6th, 2025, 3:02 pm 
Site Admin
User avatar

Joined: March 10th, 2011, 11:14 pm
Posts: 13196
Location: Earth
That's already possible, I wrote the replacement above based on your example.

The search string = if, it's only applied if matched.

_________________
themaPoster | themaCreator | themaManager | themaLeecher | themaRegister


Top
 Profile  
Reply with quote  
 Post subject: Re: If else condition for replacement.
PostPosted: May 6th, 2025, 5:18 pm 

Joined: March 30th, 2015, 12:31 pm
Posts: 725
Freddy wrote:
If the message is always in that format with "<param" just update the previous replacement to change both places at the same time (you should only have one replacement added which is below, not two - it won't work then):

Search for:
Code:
(?si)=N/A/10 - N/A\s*Votes(.+?)N/A/10\s*\(N/A Votes\)(.+?tt18923754)


Replace with:
Code:
=8.8/10 - 19K Votes$1 8.8/10 (19K Votes)$2


Enable regex search.


it did not work well. does imdb id need to be first or last?

https://i.imgur.com/6x6g9TE.png


and if i remove at the bottom it does not replace anything

iMDB Votes.......: N/A/10 (N/A Votes)
https://i.imgur.com/U3nwzR0.png

edit:

or may be just use this
(?si)N/A Votes(.+?tt18923754)=9K Votes$1
(?si)N/A/10(.+?tt18923754)=8.8/10$1


Top
 Profile  
Reply with quote  
 Post subject: Re: If else condition for replacement.
PostPosted: May 6th, 2025, 7:23 pm 
Site Admin
User avatar

Joined: March 10th, 2011, 11:14 pm
Posts: 13196
Location: Earth
You probably have some changes from previous examples. It worked fine with previous example.

I need the message as text (not images) to correct the replacement.

_________________
themaPoster | themaCreator | themaManager | themaLeecher | themaRegister


Top
 Profile  
Reply with quote  
 Post subject: Re: If else condition for replacement.
PostPosted: May 6th, 2025, 8:01 pm 

Joined: March 30th, 2015, 12:31 pm
Posts: 725
ermm not sure but i think i gave unmodified. here is the one.

https://pastebin.com/paPF0Prk


Top
 Profile  
Reply with quote  
 Post subject: Re: If else condition for replacement.
PostPosted: May 7th, 2025, 5:22 am 
Site Admin
User avatar

Joined: March 10th, 2011, 11:14 pm
Posts: 13196
Location: Earth
IMDB lines are repeated 3 times there.

The replacement which I wrote works fine, but it's only for two lines (you have multiple IMDB votes lines there), so only one place is replaced. Maybe I missed one line since it's such a long post.

You can just add one extra and it will replace all three places.

Search for:
Code:
(?si)N/A/10\s*\(N/A Votes\)(.+?)=N/A/10 - N/A\s*Votes(.+?)N/A/10\s*\(N/A Votes\)(.+?tt18923754)


Replace with:
Code:
8.8/10 (19K Votes)$1=8.8/10 - 19K Votes$2 8.8/10 (19K Votes)$3


Enable regex search.

_________________
themaPoster | themaCreator | themaManager | themaLeecher | themaRegister


Top
 Profile  
Reply with quote  
 Post subject: Re: If else condition for replacement.
PostPosted: May 8th, 2025, 12:33 am 

Joined: March 30th, 2015, 12:31 pm
Posts: 725
thank you so much. if i am not wrong your replacement combine all replace in one line. in that case can we use following replacement? it will just have multiple replacement like this:

(?si)N/A Votes(.+?tt18923754)=9K Votes$1

(?si)N/A/10(.+?tt18923754)=8.8/10$1


Top
 Profile  
Reply with quote  
 Post subject: Re: If else condition for replacement.
PostPosted: May 8th, 2025, 4:45 am 
Site Admin
User avatar

Joined: March 10th, 2011, 11:14 pm
Posts: 13196
Location: Earth
It won't work, the last two N/A Votes have only one IMDB link below, it will only replace one place and not both.

Just use my, it's one replacement and replaces all places at once. It will be faster as well having less replacements.

_________________
themaPoster | themaCreator | themaManager | themaLeecher | themaRegister


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Theme designed by stylerbb.net © 2008
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All times are UTC