Web based family history software

Question Search and replace - last character is deleted

  • mike_jpr
  • Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 2 months ago #1 by mike_jpr
In the past I used the "Search and Replace" RegEx for the place and it work fine. I make an update with the actual version (2.0.19) and I wonder why the last letter is missing for each country

I use:
Search: 2 PLAC ([^,\n]*).([^,\n]*).([^,\n]*).([^,\n]*).([^,\n]*).([^,\n]*)
Replace: 2 PLAC $6, $1,$3,$4,$5
Search method: Regular expression

I try again and see that the last character has been deleted. Is that a bug or something has to be corrected in the RegEx?
Attachments:

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago #2 by fisharebest
Replied by fisharebest on topic Search and replace - last character is deleted
I guess there's a logic error in your search pattern.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • mike_jpr
  • Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 2 months ago #3 by mike_jpr
Replied by mike_jpr on topic Search and replace - last character is deleted
I have been using it like this since version 2.0.2 and it worked.
What is now wrong?

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago #4 by fisharebest
Replied by fisharebest on topic Search and replace - last character is deleted
> What is now wrong?

I guess that the final "D" in your text is being matched by the final "." in your pattern.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

More
2 years 2 months ago #5 by fisharebest
Replied by fisharebest on topic Search and replace - last character is deleted
Your regex has 5 "." - which I guess you assume will match a comma - but only 4 commas in your input string.

Therefore the final one is matching the final letter of the string.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • mike_jpr
  • Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago - 1 year 9 months ago #6 by mike_jpr
Replied by mike_jpr on topic Search and replace - last character is deleted
I had not updated my family tree online for some time now. On the weekend it was again. Am also on the new version 2.1.4 and had hoped that the problems in the meantime are solved.
Unfortunately, it does not seem to be the case.

Again, the steps to summarize:
  • I enter the following (screenshot 1)
  • It is also displayed correctly, as it should be (screenshot 2)
  • I'll have the entire directory updated. It takes a while, but then I the chaos pure (screenshot 3)
  • I then did it manually and now I think I understand what is happening. Here at this manual update, when I call this again, it already shows me that the origin code is not designed for this case. Therefore it does not fit and for example you can see that he deletes the last letter. (screenshot 4)
  • If I repeated it several times, there would always be something missing in the front and a letter deleted in the back. Have tried it and get as with the first case, this reproduced. (screenshot 5)

Now, unfortunately, I do not know why, the individual file is updated several times. This is probably the cause of the problem.
What would have to be done so that a changed file would not be updated several times?

Can you help me with this? Thanks

PS: Note that the order of the screenshots is the reverse, i.e. screenshot 1 is the last image, screenshot 2 is the second to last, etc.
Last edit: 1 year 9 months ago by mike_jpr.

Please Log in or Create an account to join the conversation.

  • mike_jpr
  • Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago - 1 year 9 months ago #7 by mike_jpr
Replied by mike_jpr on topic Search and replace - last character is deleted
I have discovered an error on my part. For some places I had no place subdivisions. I have added a "-" to them.
I must now check whether the error still exists or whether it was just a mistake on my part.

I will report tomorrow.
Last edit: 1 year 9 months ago by mike_jpr.

Please Log in or Create an account to join the conversation.

  • mike_jpr
  • Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #8 by mike_jpr
Replied by mike_jpr on topic Search and replace - last character is deleted
OK. I would have the following feedback.
I made a smaller export with only 97 people.
It fits everything was correct, the processing was also mega fast.

I have now made a larger export with "only" 3576 people and lo and behold although the location data was exactly the same as the 97 people, it did not work. The processing was also very slow

Somehow it seems that the system does not work correctly from a quantity of data >x and a file is changed several times in a row, which has led to the above-mentioned problem.

www.webtrees.net/index.php/fr/forum/help...-deleted/reply#92581

Please Log in or Create an account to join the conversation.

  • mike_jpr
  • Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #9 by mike_jpr
Replied by mike_jpr on topic Search and replace - last character is deleted
@fisharebest

Could you please look at my problem.
I have now uploaded different size files (with 100, 163, 227, 250, 273,282 persons).
I would say up to about 250 people the conversion worked without errors, above that there was always the described problem that a part of the location was shortened.

What I could also determine, is that the progress bar worked up to 250 in a run ( to 100% ), with the files of 273 and 282 it worked up to 96-98% in a step, then a small pause and then continued. This caused the problem as seen. So my guess is that in that case already "corrected" files are converted again.

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago #10 by hermann
Regular expressions are a beast. And the one you have defined is a more complex one. And the result depends on the data. Maybe it works for 250 records and then there is an unexpected record and it goes wrong. There are several regex online test tools in the net. Have you tested your regular expression together with your data in such a tool? Does it working there or does it show the same failure?

Hermann
Designer of the custom module "Extended Family"

webtrees 2.1.19 (all custom modules installed, PHP 8.2, MariaDB 10.6) @ ahnen.hartenthaler.eu

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago - 1 year 9 months ago #11 by fisharebest
Replied by fisharebest on topic Search and replace - last character is deleted
> Could you please look at my problem.

I gave an explanation in post #4

Your regular expression ends with

.([^,\n]*)

i.e. a character followed by zero or more characters that are not comma or newline.

The "." is matching the final letter in your place name.
It is not included in the replacement string.
Therefore it is deleted...

Your problem is that your pattern assumes that the placename will always contain an exact number of commas.
If your data doesn't have this number, then you get the result that you see.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net
Last edit: 1 year 9 months ago by fisharebest.

Please Log in or Create an account to join the conversation.

  • mike_jpr
  • Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #12 by mike_jpr
Replied by mike_jpr on topic Search and replace - last character is deleted
Yes, that is correct, therefore I had communicated with the one post that I try it again, because I provide the last blank with -, so that the number of commas is always the same.
I am just always surprised why something that used to work suddenly no longer works.

Please Log in or Create an account to join the conversation.

More
1 year 9 months ago #13 by fisharebest
Replied by fisharebest on topic Search and replace - last character is deleted
Can you give a specific example that does not work.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • mike_jpr
  • Topic Author
  • Offline
  • New Member
  • New Member
More
1 year 9 months ago #14 by mike_jpr
Replied by mike_jpr on topic Search and replace - last character is deleted
Thanks for the support. I will send you the file by email

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum
}