Welcome, Guest
Python Scripts for ComicRack

TOPIC: Data Manager 2.xx Series for ComicRack

Data Manager 2.xx Series for ComicRack 7 months 2 weeks ago #47694

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 771
  • Thank you received: 254
  • Karma: 55
I seem to be hitting the old bug with RegexReplace with a twist that it is difficult to even write a rule as the value often defaults to pre-existing values.

This script is hanging for no reason:


File Attachment:

File Name: RegexTest.zip
File Size:0 KB


It doesn't seem to matter what the match expression actually is.
Last Edit: 7 months 2 weeks ago by jkthemac.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 7 months 2 weeks ago #47695

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
jkthemac wrote:
I seem to be hitting the old bug with RegexReplace with a twist that it is difficult to even write a rule as the value often defaults to pre-existing values.

This script is hanging for no reason:


File Attachment:

File Name: RegexTest.zip
File Size:0 KB


It doesn't seem to matter what the match expression actually is.

why is your content a mix of old and new format?
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 7 months 2 weeks ago #47696

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 771
  • Thank you received: 254
  • Karma: 55
Is it?
I wasn't under the impression things had chaged that much. This is a simple Regex replace, they have been working in previous versions. What is wrong with it? Only the Regex fails and it is generated by the script. It isn't hand coded.

Also the difficulty writing them is there regardless but that seems intermittent so I haven't worked out a way to describe it.
Last Edit: 7 months 2 weeks ago by jkthemac.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 7 months 2 weeks ago #47697

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
jkthemac wrote:
Is it?
I wasn't under the impression things had chaged that much. This is a simple Regex replace, they have been working in previous versions. What is wrong with it?

Also the difficulty writing then is there regardless.

yeah should be in xml unless you are on a early version of 2.xx
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<collection version="2.1.0">
  <ruleset name="Shorten 10 or more" rulesetmode="AND">
    <rule field="Series" modifier="RegEx" value="^.........." />
    <action field="BookOwner" modifier="SetValue" value="{Series}" />
    <action field="BookOwner" modifier="RegexReplace" value="^(.*)$||$1" />
  </ruleset>
  <disabled/>
</collection>

I'll test and examine when i get a chance. Also ... just what exactley are you attempting to accomplish?

Edit: nevermind figured it out...

try
^[^\n]{10})
Last Edit: 7 months 2 weeks ago by T3KN0Gh057.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 7 months 2 weeks ago #47698

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 771
  • Thank you received: 254
  • Karma: 55
No I am using the latest version. 'Data Manager 2.04.05. r785' This is what is being generated. Could it have become corrupted maybe?

That is a test. It shouldn't change the field at all. As I say I cant get it to do any RegexReplace at all. This is the most basic Regex I could think of apart from maybe ^(.) which also wont work.
Last Edit: 7 months 2 weeks ago by jkthemac.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 7 months 2 weeks ago #47699

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
weird...

Let me see what's going on.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 7 months 2 weeks ago #47700

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 771
  • Thank you received: 254
  • Karma: 55
try
^[^\n]{10})

It doesn't matter what the rule is, it is hanging on 0 of 1 books.

BTW figured out what is happening with writing the rules. If the field is a custom one it won't let me edit the value. It works with a real field, and then I can swap the Field to the one I want.
Last Edit: 7 months 2 weeks ago by jkthemac.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 7 months 2 weeks ago #47701

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
I think the problem here is it's going into an infinite loop

RegExReplace replaces all instances of the match, and since its going to keep matching 10 places, its going to continue forever.
        while RegExp.Match(myString).Success:
        #while RegExp.match:
            #myString = RegExp.sub(myString, setFormat)
            myString = RegExp.Replace(myString, setFormat)        
        
        strReport = self.SetFieldValue(book, myString)
try this
^([^\n]{10}).+

that will ensure once the match is made and you've shortened to 10 spaces it stops looking (because it's looking for anything that continues on past 10 spaces...)

EDIT: Currently investigating why custom fields would behave any different
Last Edit: 7 months 2 weeks ago by T3KN0Gh057.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 7 months 2 weeks ago #47702

  • jkthemac
  • jkthemac's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 771
  • Thank you received: 254
  • Karma: 55
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.
Last Edit: 7 months 2 weeks ago by jkthemac.
The administrator has disabled public write access.

Data Manager 2.xx Series for ComicRack 7 months 2 weeks ago #47703

  • T3KN0Gh057
  • T3KN0Gh057's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 407
  • Thank you received: 114
  • Karma: 27
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 find 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 "

My Code:
         while RegExp.Match(myString).Success:

code for what you're assuming:
         for (match in RegExp.Matches(myString)):
the difference being that mine finds/replaces a match repeatedly (which i did to be able to completely clean a string), and the other looks at all matches at once, so that it has no option to find if the Replace function created another instance of the match.
I know that's not the problem you're referring to , but its something to think about once i do find the problem.
Last Edit: 7 months 2 weeks ago by T3KN0Gh057.
The administrator has disabled public write access.
Time to create page: 0.207 seconds

Who's Online

We have 202 guests and 7 members online