Welcome, Guest
Python Scripts for ComicRack

TOPIC: Data Manager 2.xx Series for ComicRack

Data Manager 2.xx Series for ComicRack 4 months 1 week ago #47704

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 760
  • Thank you received: 248
  • Karma: 55
T3KN0Gh057 wrote:
jkthemac wrote:
No honestly. I tried it. Same result, and I have tried a few rules that were working for me before too. Just in case there has been some version corruption I am totally removing and reloading the script. I will let you know if that helps.

I was origianally using ^(..........) that is the simplest (and most efficient) regex you can do for what I want, and it can only match the first 10 characters so it cant keep going. Even without the anchor it would only loop until it hit the end of the field, but it should only match the first hit.



maybe I'm wrong but I wrote the regexp replace with intent to keep going until it does not finf the Regex in the value anymore...

I think you're assuming it resumes looking at the end of the match, but that's not how i wrote it to work. After every replacement it looks again to see if a regex match still exists... in the ENTIRE string ^(..........) would create an infinite loop

"Jerry was a racecar driver" would be changed to "Jerry was " then it looks at "Jerry was " and still finds a match to "^(..........)" so it writes again, and again and again Continually matching "Jerry was "

Matches work their way through the whole expression on the first pass, so you wouldn't ever need to loop it. I cant see why you would do that. But I have tried your solution with no differing result. To clarify the rule works fine, it is just the Action that won't work with any RegexReplace Expression at all.

BTW I have tried uninstalling and reloading Data Manager with no luck.
Last Edit: 4 months 1 week ago by jkthemac.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 4 months 1 week ago #47705

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 760
  • Thank you received: 248
  • Karma: 55
It is saving the rules with XML properly now. I am not sure it has been doing that properly ever, so there may have been an iterative update problem somewhere.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 4 months 1 week ago #47706

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
jkthemac wrote:
T3KN0Gh057 wrote:
jkthemac wrote:
No honestly. I tried it. Same result, and I have tried a few rules that were working for me before too. Just in case there has been some version corruption I am totally removing and reloading the script. I will let you know if that helps.

I was origianally using ^(..........) that is the simplest (and most efficient) regex you can do for what I want, and it can only match the first 10 characters so it cant keep going. Even without the anchor it would only loop until it hit the end of the field, but it should only match the first hit.



maybe I'm wrong but I wrote the regexp replace with intent to keep going until it does not finf the Regex in the value anymore...

I think you're assuming it resumes looking at the end of the match, but that's not how i wrote it to work. After every replacement it looks again to see if a regex match still exists... in the ENTIRE string ^(..........) would create an infinite loop

"Jerry was a racecar driver" would be changed to "Jerry was " then it looks at "Jerry was " and still finds a match to "^(..........)" so it writes again, and again and again Continually matching "Jerry was "

Matches work their way through the whole expression on the first pass, so you wouldn't ever need to loop it. I cant see why you would do that. But I have tried your solution with no differing result. To clarify the rule works fine, it is just the Action that won't work with any RegexReplace Expression at all.

BTW I have tried uninstalling and reloading Data Manager with no luck.

Because there is the chance that working through matches, may create a match of its own, the function creates a Collection of matches which is what it is at invocation and will not change should anothe match be created during Replacement, looping back over a match several times ensures ALL matches are replaced even if Replacement creates a match.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 4 months 1 week ago #47708

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 760
  • Thank you received: 248
  • Karma: 55
Honestly I don't even know what that means in the context of a regex replacement. It only needs to match what it matches. It is up to the writer of the expression to make sure they capture everything they want to capture.

A match only ever matches in a single way, and a replacement uses that match to decide what gets replaced. There can't ever be more than one match.

In the case of the changed field it gets created as the match rolls through the target text, just like search and replace. It will work it's way to the bottom and stop. It wont loop. Anything new is behind the pointer. It cant be considered for a match.
Last Edit: 4 months 1 week ago by jkthemac.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 4 months 1 week ago #47709

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 760
  • Thank you received: 248
  • Karma: 55
Take for example replace .. With 12 on a target of qwertyu
The result would be 121212u.

Each time it matches .. It moves the pointer two spaces forwards. It never needs to look back and it stops when there is no longer a match. So when it gets to u it no longer matches two characters.

The Regex function does all of that. There is no need to run it more than once.


$ substitution can be tricky so they should be anchored.

^(.....).*$ matches the whole sting and sets the first five characters as $1. Without the part after the brackets anchor it just swaps the first five letters for the first five letters leaving the same result as the original target string. But both will work fine. No recursion occurs.

^(.....).*$||$1 should result in qwert
^(.....)||$ sould result in qwertyu

The very fact we are even considering infinite recursions demonstrates that the function is not acting in a logical and standard manner.
Last Edit: 4 months 1 week ago by jkthemac.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 4 months 1 week ago #47710

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
jkthemac wrote:
Honestly I don't even know what that means in the context of a regex replacement. It only needs to match what it matches. It is up to the writer of the expression to make sure they capture everything they want to capture.

A match only ever matches in a single way, and a replacement uses that match to decide what gets replaced. There can't ever be more than one match.

In the case of the changed field it gets created as the match rolls through the target text, just like search and replace. It will work it's way to the bottom and stop. It wont loop. Anything new is behind the pointer. It cant be considered for a match.

Well lets just say that's not the way I want it to work, you're welcome to adjust that, in your own copy of the Data Manager script, but for me I want the ability to COMPLETELY clean a string with ONE Statement. And that's what this accomplishes. Maybe I'll add a toggle in the general settings of the next revision that makes it behave the way you want. But for me, behind the point or not... when i write a statement to remove instances of a pattern I want all instances removed. Not just the ones it finds on a single inspection.
Last Edit: 4 months 1 week ago by T3KN0Gh057.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 4 months 1 week ago #47711

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 760
  • Thank you received: 248
  • Karma: 55
T3KN0Gh057 wrote:
jkthemac wrote:
Honestly I don't even know what that means in the context of a regex replacement. It only needs to match what it matches. It is up to the writer of the expression to make sure they capture everything they want to capture.

A match only ever matches in a single way, and a replacement uses that match to decide what gets replaced. There can't ever be more than one match.

In the case of the changed field it gets created as the match rolls through the target text, just like search and replace. It will work it's way to the bottom and stop. It wont loop. Anything new is behind the pointer. It cant be considered for a match.

Well lets just say that's not the way I want it to work, you're welcome to adjust that, in your own copy of the Data Manager script, but for me I want the ability to COMPLETELY clean a string with ONE Statement. And that's what this accomplishes. Maybe I'll add a toggle in the general settings of the next revision that makes it behave the way you want. But for me, behind the point or not... when i write a statement to remove instances of a pattern I want all instances removed. Not just the ones it finds on a single inspection.

But that wouldn't be a Regex replacement by the standards. That is an extended iteration that is doomed to confuse anyone used to the standard. See my cross post.
Last Edit: 4 months 1 week ago by jkthemac.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 4 months 1 week ago #47716

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
jkthemac wrote:
But that wouldn't be a Regex replacement by the standards. That is an extended iteration that is doomed to confuse anyone used to the standard. See my cross post.

first of all I don't mean it to work in the "standard" way (I don't think there is a such thing regex is a tool and its used however the user wants)
If everything had to be by standards we wouldn't even have the ability to do plugins in ComicRack, Or comicrack itself considering cbz/cbr/cbt,etc are not the INDUSTRY standard for digital comics.

lets say my string is
I don't believe in qweqwertyrty standards
if i do it the way you consider standard
(.+)qwerty(.+)
leaves me with
I don't believe in qwerty standards
the way I DO IT leaves
I don't believe in  standards

without having to run another copy of that regex to clean it up

I've seen this technique used in many other "apps" including Kodi movie/tvshow scrapers...
the repitition you consider doomed to confuse seems logical to me...
of course it makes it necessary to be more specific in your regex's (instead of playing loose and carefree) so that one only affects what he's trying to affect... but i think THAT SHOULD be the standard, being more precise as to what one is asking for so as to get only that, in life and regular expressions .

lets revisit your problem.

you want to shorten to ten spaces...

now with your general expression ^(..........)
that matches anything with 10 spaces starting at the beginning
so even if a string is already exactly 10 spaces it will match so yes in my code it will continually match
however what really want to match is only strings larger than 10 characters from the beginning and use only the first 10 characters

if there is confusion anywhere its in your regular expression.
Last Edit: 4 months 1 week ago by T3KN0Gh057.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 4 months 1 week ago #47719

  • rmagere
  • rmagere's Avatar
  • Offline
  • Gold Boarder
  • Posts: 219
  • Thank you received: 23
  • Karma: 6
I read these posts for learning - even though most of it goes over my head - as such forgive if the following question is stupid:

Given the example belowT3KN0Gh057 wrote:
lets say my string is
I don't believe in qweqwertyrty standards
if i do it the way you consider standard
(.+)qwerty(.+)
leaves me with
I don't believe in qwerty standards
the way I DO IT leaves
I don't believe in  standards
without having to run another copy of that regex to clean it up

I understand that -if there were no recursion- to go from
I don't believe in qweqwertyrty standards
to
I don't believe in  standards
I would need to run the same regex twice.

However I am not clear -with recursion enable- if I actually want to go from:
I don't believe in qweqwertyrty standards
to
I don't believe in qwerty standards
is that possible? or does it become an impossible substitution? (well I guess I could always search for "don't believe in standards" and replace with "don't believe in qwerty standards" but that assumes I know all instances where this might have occured)

Thanks
Last Edit: 4 months 1 week ago by rmagere.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 4 months 1 week ago #47720

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
rmagere wrote:
I read these posts for learning - even though most of it goes over my head - as such forgive if the following question is stupid:

Given the example belowT3KN0Gh057 wrote:
lets say my string is
I don't believe in qweqwertyrty standards
if i do it the way you consider standard
(.+)qwerty(.+)
leaves me with
I don't believe in qwerty standards
the way I DO IT leaves
I don't believe in  standards
without having to run another copy of that regex to clean it up

I understand that -if there were no recursion- to go from
I don't believe in qweqwertyrty standards
to
I don't believe in  standards
I would need to run the same regex twice.

However I am not clear -with recursion enable- if I actually want to go from:
I don't believe in qweqwertyrty standards
to
I don't believe in qwerty standards
is that possible? or does it become an impossible substitution? (well I guess I could always search for "don't believe in standards" and replace with "don't believe in qwerty standards" but that assumes I know all instances where this might have occured)

Thanks
That's why I'm considering a behavioural toggle...
The administrator has disabled public write access.
Time to create page: 0.201 seconds

Who's Online

We have 216 guests and 5 members online