- Posts: 65
Question Search and replace - last character is deleted
- mike_jpr
- Topic Author
- Offline
- New Member
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?
Please Log in or Create an account to join the conversation.
- fisharebest
- Offline
- Administrator
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
- Posts: 65
What is now wrong?
Please Log in or Create an account to join the conversation.
- fisharebest
- Offline
- Administrator
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.
- fisharebest
- Offline
- Administrator
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
- Posts: 65
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.
Please Log in or Create an account to join the conversation.
- mike_jpr
- Topic Author
- Offline
- New Member
- Posts: 65
I must now check whether the error still exists or whether it was just a mistake on my part.
I will report tomorrow.
Please Log in or Create an account to join the conversation.
- mike_jpr
- Topic Author
- Offline
- New Member
- Posts: 65
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
- Posts: 65
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.
- hermann
- Offline
- Elite Member
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.
- fisharebest
- Offline
- Administrator
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
Please Log in or Create an account to join the conversation.
- mike_jpr
- Topic Author
- Offline
- New Member
- Posts: 65
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.
- fisharebest
- Offline
- Administrator
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
- Posts: 65
Please Log in or Create an account to join the conversation.